Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stubs/click-shell/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version = "2.1"
upstream_repository = "https://github.com/clarkperkins/click-shell"
requires = ["click>=8.0.0"]
7 changes: 7 additions & 0 deletions stubs/click-shell/click_shell/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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]
28 changes: 28 additions & 0 deletions stubs/click-shell/click_shell/_cmd.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
10 changes: 10 additions & 0 deletions stubs/click-shell/click_shell/_compat.pyi
Original file line number Diff line number Diff line change
@@ -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]: ...
35 changes: 35 additions & 0 deletions stubs/click-shell/click_shell/core.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
8 changes: 8 additions & 0 deletions stubs/click-shell/click_shell/decorators.pyi
Original file line number Diff line number Diff line change
@@ -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]: ...
Loading