|
| 1 | +import typing as t |
| 2 | + |
| 3 | +import click |
| 4 | +from click.core import Context as Context |
| 5 | +from click.core import Group as Group |
| 6 | +from click.core import Option as Option |
| 7 | +from click.core import Parameter as Parameter |
| 8 | +from click.decorators import confirmation_option as confirmation_option |
| 9 | +from click.decorators import help_option as help_option |
| 10 | +from click.decorators import make_pass_decorator as make_pass_decorator |
| 11 | +from click.decorators import pass_context as pass_context |
| 12 | +from click.decorators import pass_obj as pass_obj |
| 13 | +from click.decorators import password_option as password_option |
| 14 | +from click.decorators import version_option as version_option |
| 15 | +from click.exceptions import Abort as Abort |
| 16 | +from click.exceptions import BadArgumentUsage as BadArgumentUsage |
| 17 | +from click.exceptions import BadOptionUsage as BadOptionUsage |
| 18 | +from click.exceptions import BadParameter as BadParameter |
| 19 | +from click.exceptions import ClickException as ClickException |
| 20 | +from click.exceptions import Exit as Exit |
| 21 | +from click.exceptions import FileError as FileError |
| 22 | +from click.exceptions import MissingParameter as MissingParameter |
| 23 | +from click.exceptions import NoSuchOption as NoSuchOption |
| 24 | +from click.exceptions import UsageError as UsageError |
| 25 | +from click.types import BOOL as BOOL |
| 26 | +from click.types import FLOAT as FLOAT |
| 27 | +from click.types import INT as INT |
| 28 | +from click.types import STRING as STRING |
| 29 | +from click.types import UNPROCESSED as UNPROCESSED |
| 30 | +from click.types import UUID as UUID |
| 31 | +from click.types import Choice as Choice |
| 32 | +from click.types import DateTime as DateTime |
| 33 | +from click.types import File as File |
| 34 | +from click.types import FloatRange as FloatRange |
| 35 | +from click.types import IntRange as IntRange |
| 36 | +from click.types import ParamType as ParamType |
| 37 | +from click.types import Path as Path |
| 38 | +from click.types import Tuple as Tuple |
| 39 | +from click.utils import echo as echo |
| 40 | +from click.utils import format_filename as format_filename |
| 41 | +from click.utils import get_app_dir as get_app_dir |
| 42 | +from click.utils import get_binary_stream as get_binary_stream |
| 43 | +from click.utils import get_text_stream as get_text_stream |
| 44 | +from click.utils import open_file as open_file |
| 45 | + |
| 46 | +from .argument import Argument |
| 47 | +from .command import Command |
| 48 | +from .group import AppContextGroup, EllarCommandGroup |
| 49 | +from .util import with_app_context |
| 50 | + |
| 51 | + |
| 52 | +def argument( |
| 53 | + *param_decls: str, |
| 54 | + cls: t.Optional[t.Type[click.Argument]] = None, |
| 55 | + required: bool = True, |
| 56 | + help: t.Optional[str] = None, |
| 57 | + hidden: t.Optional[bool] = None, |
| 58 | + **attrs: t.Any, |
| 59 | +) -> t.Callable: |
| 60 | + return click.argument( |
| 61 | + *param_decls, |
| 62 | + cls=cls or Argument, |
| 63 | + required=required, |
| 64 | + hidden=hidden, |
| 65 | + help=help, |
| 66 | + **attrs, |
| 67 | + ) |
| 68 | + |
| 69 | + |
| 70 | +def option( |
| 71 | + *param_decls: str, cls: t.Optional[t.Type[Option]] = None, **attrs: t.Any |
| 72 | +) -> t.Callable: |
| 73 | + return click.option(*param_decls, cls=cls, **attrs) |
| 74 | + |
| 75 | + |
| 76 | +def command( |
| 77 | + name: t.Optional[str] = None, cls: t.Optional[click.Command] = None, **attrs: t.Any |
| 78 | +) -> t.Union[click.Command, t.Any]: |
| 79 | + return click.command(name=name, cls=cls or Command, **attrs) # type:ignore[arg-type] |
| 80 | + |
| 81 | + |
| 82 | +def group( |
| 83 | + name: t.Union[str, t.Callable, None] = None, |
| 84 | + cls: t.Optional[t.Type[click.Group]] = None, |
| 85 | + **attrs: t.Any, |
| 86 | +) -> t.Callable: |
| 87 | + return click.group(name=name, cls=cls or AppContextGroup, **attrs) # type:ignore[arg-type] |
| 88 | + |
| 89 | + |
| 90 | +__all__ = [ |
| 91 | + "argument", |
| 92 | + "Argument", |
| 93 | + "Option", |
| 94 | + "option", |
| 95 | + "AppContextGroup", |
| 96 | + "EllarCommandGroup", |
| 97 | + "with_app_context", |
| 98 | + "Context", |
| 99 | + "Group", |
| 100 | + "Parameter", |
| 101 | + "make_pass_decorator", |
| 102 | + "confirmation_option", |
| 103 | + "help_option", |
| 104 | + "group", |
| 105 | + "pass_context", |
| 106 | + "password_option", |
| 107 | + "version_option", |
| 108 | + "Abort", |
| 109 | + "BadArgumentUsage", |
| 110 | + "BadOptionUsage", |
| 111 | + "BadParameter", |
| 112 | + "ClickException", |
| 113 | + "FileError", |
| 114 | + "MissingParameter", |
| 115 | + "NoSuchOption", |
| 116 | + "UsageError", |
| 117 | + "pass_obj", |
| 118 | + "BOOL", |
| 119 | + "Choice", |
| 120 | + "DateTime", |
| 121 | + "File", |
| 122 | + "FLOAT", |
| 123 | + "FloatRange", |
| 124 | + "INT", |
| 125 | + "IntRange", |
| 126 | + "ParamType", |
| 127 | + "Path", |
| 128 | + "STRING", |
| 129 | + "Tuple", |
| 130 | + "UNPROCESSED", |
| 131 | + "UUID", |
| 132 | + "echo", |
| 133 | + "format_filename", |
| 134 | + "get_app_dir", |
| 135 | + "get_binary_stream", |
| 136 | + "get_text_stream", |
| 137 | + "open_file", |
| 138 | + "Exit", |
| 139 | +] |
| 140 | + |
| 141 | + |
| 142 | +def __dir__() -> t.List[str]: |
| 143 | + return sorted(__all__) # pragma: no cover |
0 commit comments