-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add types for click completion
- Loading branch information
1 parent
abbe94e
commit a8557ce
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from enum import Enum | ||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union | ||
|
||
import click | ||
from click import ParamType | ||
|
||
__version__: str | ||
_initialized: bool | ||
|
||
def init(complete_options: bool = False, match_incomplete: Optional[Callable[[str, str], bool]] = None) -> None: ... | ||
|
||
class DocumentedChoice(ParamType): | ||
name: str | ||
def __init__(self, choices: Union[Dict[str, str], Enum]) -> None: ... | ||
def get_metavar(self, param: Any) -> str: ... | ||
def get_missing_message(self, param: Any) -> str: ... | ||
def convert(self, value: str, param: Any, ctx: click.Context) -> Optional[str]: ... | ||
def __repr__(self) -> str: ... | ||
def complete(self, ctx: click.Context, incomplete: str) -> List[Tuple[str, str]]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from enum import Enum | ||
from typing import Callable, Dict, Generator, List, Optional, Tuple | ||
|
||
import click | ||
|
||
shells: Dict[str, str] | ||
|
||
class Shell(Enum): | ||
bash: str | ||
fish: str | ||
zsh: str | ||
powershell: str | ||
|
||
def startswith(string: str, incomplete: str) -> bool: ... | ||
|
||
class CompletionConfiguration: | ||
complete_options: bool | ||
match_complete: Callable[[str, str], bool] | ||
|
||
def __init__(self) -> None: ... | ||
|
||
def match(string: str, incomplete: str) -> bool: ... | ||
def get_choices( | ||
cli: click.Command, prog_name: str, args: List[str], incomplete: str | ||
) -> Generator[Tuple[str, Optional[str]], None, None]: ... | ||
def do_bash_complete(cli: click.Command, prog_name: str) -> bool: ... | ||
def do_fish_complete(cli: click.Command, prog_name: str) -> bool: ... | ||
def do_zsh_complete(cli: click.Command, prog_name: str) -> bool: ... | ||
def do_powershell_complete(cli: click.Command, prog_name: str) -> bool: ... | ||
def get_code( | ||
shell: Optional[Shell] = None, | ||
prog_name: Optional[str] = None, | ||
env_name: Optional[str] = None, | ||
extra_env: Optional[Dict[str, str]] = None, | ||
) -> str: ... | ||
def install( | ||
shell: Optional[Shell] = None, | ||
prog_name: Optional[str] = None, | ||
env_name: Optional[str] = None, | ||
path: Optional[str] = None, | ||
append: Optional[bool] = None, | ||
extra_env: Optional[Dict[str, str]] = None, | ||
) -> Tuple[Shell, str]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from typing import List, Optional | ||
|
||
import click | ||
|
||
def single_quote(s: str) -> str: ... | ||
def double_quote(s: str) -> str: ... | ||
def resolve_ctx( | ||
cli: click.Command, prog_name: str, args: List[str], resilient_parsing: bool = True | ||
) -> Optional[click.core.Context]: ... | ||
def split_args(line: str) -> List[str]: ... | ||
def get_auto_shell() -> str: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from typing import List, Optional, Tuple | ||
|
||
import click | ||
|
||
def param_type_complete(self: click.ParamType, ctx: click.core.Context, incomplete: str) -> List[Tuple[str, Optional[str]]]: ... | ||
def choice_complete(self: click.Choice, ctx: click.core.Context, incomplete: str) -> List[Tuple[str, Optional[str]]]: ... | ||
def multicommand_get_command_short_help(self: click.MultiCommand, ctx: click.Context, cmd_name: str) -> str: ... | ||
def multicommand_get_command_hidden(self: click.MultiCommand, ctx: click.Context, cmd_name: str) -> bool: ... | ||
def _shellcomplete(cli: click.Command, prog_name: str, complete_var: Optional[str] = None) -> None: ... | ||
def patch() -> None: ... |