mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
[click-shell] Add stubs for click-shell (#14578)
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
version = "2.1"
|
||||
upstream_repository = "https://github.com/clarkperkins/click-shell"
|
||||
requires = ["click>=8.0.0"]
|
||||
@@ -0,0 +1,7 @@
|
||||
from typing import Final
|
||||
|
||||
from .core import Shell as Shell, make_click_shell as make_click_shell
|
||||
from .decorators import shell as shell
|
||||
|
||||
__all__ = ["make_click_shell", "shell", "Shell", "__version__"]
|
||||
__version__: Final[str]
|
||||
@@ -0,0 +1,28 @@
|
||||
from cmd import Cmd
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar, TextIO
|
||||
|
||||
import click
|
||||
|
||||
class ClickCmd(Cmd):
|
||||
nocommand: ClassVar[str]
|
||||
def __init__(
|
||||
self,
|
||||
ctx: click.Context | None = None,
|
||||
on_finished: Callable[[click.Context], None] | None = None,
|
||||
hist_file: str | None = None,
|
||||
completekey: str = "tab",
|
||||
stdin: TextIO | None = None,
|
||||
stdout: TextIO | None = None,
|
||||
) -> None: ...
|
||||
def preloop(self) -> None: ...
|
||||
def postloop(self) -> None: ...
|
||||
def cmdloop(self, intro: str | None = None) -> None: ...
|
||||
def get_prompt(self) -> str | None: ...
|
||||
def emptyline(self) -> bool: ...
|
||||
def default(self, line: str) -> None: ...
|
||||
def get_names(self) -> list[str]: ...
|
||||
def do_help(self, arg: str) -> None: ...
|
||||
def do_quit(self, arg: str) -> bool: ...
|
||||
def do_exit(self, arg: str) -> bool: ...
|
||||
def print_topics(self, header: Any, cmds: list[str] | None, cmdlen: int, maxcol: int) -> None: ...
|
||||
@@ -0,0 +1,10 @@
|
||||
import types
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Final
|
||||
|
||||
import click
|
||||
|
||||
PY2: Final = False
|
||||
|
||||
def get_method_type(func: Callable[..., Any], obj: object) -> types.MethodType: ...
|
||||
def get_choices(cli: click.Command, prog_name: str, args: list[str], incomplete: str) -> list[str]: ...
|
||||
@@ -0,0 +1,35 @@
|
||||
from collections.abc import Callable
|
||||
from logging import Logger
|
||||
from typing import Any
|
||||
|
||||
import click
|
||||
|
||||
from ._cmd import ClickCmd
|
||||
|
||||
logger: Logger
|
||||
|
||||
def get_invoke(command: click.Command) -> Callable[[ClickCmd, str], bool]: ...
|
||||
def get_help(command: click.Command) -> Callable[[ClickCmd], None]: ...
|
||||
def get_complete(command: click.Command) -> Callable[[ClickCmd, str, str, int, int], list[str]]: ...
|
||||
|
||||
class ClickShell(ClickCmd):
|
||||
def add_command(self, cmd: click.Command, name: str) -> None: ...
|
||||
|
||||
def make_click_shell(
|
||||
ctx: click.Context,
|
||||
prompt: str | Callable[[], str] | Callable[[click.Context, str], str] | None = None,
|
||||
intro: str | None = None,
|
||||
hist_file: str | None = None,
|
||||
) -> ClickShell: ...
|
||||
|
||||
class Shell(click.Group):
|
||||
def __init__(
|
||||
self,
|
||||
prompt: str | Callable[[], str] | Callable[[click.Context, str], str] | None = None,
|
||||
intro: str | None = None,
|
||||
hist_file: str | None = None,
|
||||
on_finished: Callable[[click.Context], None] | None = None,
|
||||
**attrs: Any,
|
||||
) -> None: ...
|
||||
def add_command(self, cmd: click.Command, name: str | None = None) -> None: ...
|
||||
def invoke(self, ctx: click.Context) -> Any: ...
|
||||
@@ -0,0 +1,8 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from click.decorators import _AnyCallable
|
||||
|
||||
from .core import Shell
|
||||
|
||||
def shell(name: str | None = None, **attrs: Any) -> Callable[[_AnyCallable], Shell]: ...
|
||||
Reference in New Issue
Block a user