class ShellComplete:
Known subclasses: click.shell_completion.BashComplete
, click.shell_completion.FishComplete
, click.shell_completion.ZshComplete
Base class for providing shell completion support. A subclass for a given shell will override attributes and methods to implement the completion instructions (source and complete).
Parameters | |
cli | Command being called. |
prog_name | Name of the executable in the shell. |
complete_var | Name of the environment variable that holds the completion instruction. |
Method | complete |
Produce the completion data to send back to the shell. |
Method | format_completion |
Format a completion item into the form recognized by the shell script. This must be implemented by subclasses. |
Method | get_completion_args |
Use the env vars defined by the shell script to return a tuple of args, incomplete. This must be implemented by subclasses. |
Method | get_completions |
Determine the context and last complete command or parameter from the complete args. Call that object's shell_complete method to get the completions for the incomplete value. |
Method | source |
No summary |
Method | source_vars |
Vars for formatting source_template . |
Class Variable | name |
Name to register the shell as with add_completion_class . This is used in completion instructions ({name}_source and {name}_complete). |
Class Variable | source_template |
Completion script template formatted by source . This must be provided by subclasses. |
Property | func_name |
The name of the shell function defined by the completion script. |
Method | __init__ |
Undocumented |
Instance Variable | cli |
Undocumented |
Instance Variable | complete_var |
Undocumented |
Instance Variable | ctx_args |
Undocumented |
Instance Variable | prog_name |
Undocumented |
Produce the completion data to send back to the shell.
By default this calls get_completion_args
, gets the
completions, then calls format_completion
for each
completion.
Returns | |
str | Undocumented |
click.shell_completion.BashComplete
, click.shell_completion.FishComplete
, click.shell_completion.ZshComplete
Parameters | |
item:CompletionItem | Completion item to format. |
Returns | |
str | Undocumented |
click.shell_completion.BashComplete
, click.shell_completion.FishComplete
, click.shell_completion.ZshComplete
Returns | |
t.Tuple[ | Undocumented |
Parameters | |
args:t.List[ | List of complete args before the incomplete value. |
incomplete:str | Value being completed. May be empty. |
Returns | |
t.List[ | Undocumented |
click.shell_completion.BashComplete
source_template
with the dict returned by
source_vars
.Returns | |
str | Undocumented |
Vars for formatting source_template
.
By default this provides complete_func, complete_var, and prog_name.
Returns | |
t.Dict[ | Undocumented |
t.ClassVar[ str]
=
click.shell_completion.BashComplete
, click.shell_completion.FishComplete
, click.shell_completion.ZshComplete
add_completion_class
.
This is used in completion instructions ({name}_source and
{name}_complete).t.ClassVar[ str]
=
source
. This must
be provided by subclasses.Undocumented
Parameters | |
cli:BaseCommand | Undocumented |
ctx_args:t.Dict[ | Undocumented |
prog_name:str | Undocumented |
complete_var:str | Undocumented |