diff options
author | David Lord <davidism@gmail.com> | 2022-04-28 11:05:06 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-04-28 11:05:06 -0700 |
commit | 501dec6e4324f289eee598a77865a6de95b62727 (patch) | |
tree | c62c4007aa83f9623f9cdc99be2097a5aef3cd4a /src/click/shell_completion.py | |
parent | 0aec1168ac591e159baf6f61026d6ae322c53aaf (diff) | |
download | click-parser-rewrite.tar.gz |
workparser-rewrite
Diffstat (limited to 'src/click/shell_completion.py')
-rw-r--r-- | src/click/shell_completion.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/click/shell_completion.py b/src/click/shell_completion.py index c17a8e6..5149b38 100644 --- a/src/click/shell_completion.py +++ b/src/click/shell_completion.py @@ -4,7 +4,7 @@ import typing as t from gettext import gettext as _ from .core import Argument -from .core import BaseCommand +from .core import Command from .core import Context from .core import MultiCommand from .core import Option @@ -15,7 +15,7 @@ from .utils import echo def shell_complete( - cli: BaseCommand, + cli: Command, ctx_args: t.Dict[str, t.Any], prog_name: str, complete_var: str, @@ -213,7 +213,7 @@ class ShellComplete: def __init__( self, - cli: BaseCommand, + cli: Command, ctx_args: t.Dict[str, t.Any], prog_name: str, complete_var: str, @@ -482,7 +482,7 @@ def _is_incomplete_option(ctx: Context, args: t.List[str], param: Parameter) -> def _resolve_context( - cli: BaseCommand, ctx_args: t.Dict[str, t.Any], prog_name: str, args: t.List[str] + cli: Command, ctx_args: t.Dict[str, t.Any], prog_name: str, args: t.List[str] ) -> Context: """Produce the context hierarchy starting with the command and traversing the complete arguments. This only follows the commands, @@ -494,7 +494,7 @@ def _resolve_context( """ ctx_args["resilient_parsing"] = True ctx = cli.make_context(prog_name, args.copy(), **ctx_args) - args = ctx.protected_args + ctx.args + args = ctx.args while args: command = ctx.command @@ -507,7 +507,7 @@ def _resolve_context( return ctx ctx = cmd.make_context(name, args, parent=ctx, resilient_parsing=True) - args = ctx.protected_args + ctx.args + args = ctx.args else: while args: name, cmd, args = command.resolve_command(ctx, args) @@ -526,7 +526,7 @@ def _resolve_context( args = sub_ctx.args ctx = sub_ctx - args = [*sub_ctx.protected_args, *sub_ctx.args] + args = sub_ctx.args else: break @@ -535,7 +535,7 @@ def _resolve_context( def _resolve_incomplete( ctx: Context, args: t.List[str], incomplete: str -) -> t.Tuple[t.Union[BaseCommand, Parameter], str]: +) -> t.Tuple[t.Union[Command, Parameter], str]: """Find the Click object that will handle the completion of the incomplete value. Return the object and the incomplete value. |