recline.vendor.argcomplete package
Subpackages
Submodules
recline.vendor.argcomplete.completers module
- class recline.vendor.argcomplete.completers.BaseCompleter
Bases:
object
This is the base class that all argcomplete completers should subclass.
- class recline.vendor.argcomplete.completers.ChoicesCompleter(choices)
Bases:
BaseCompleter
- class recline.vendor.argcomplete.completers.DirectoriesCompleter
Bases:
_FilteredFilesCompleter
- class recline.vendor.argcomplete.completers.FilesCompleter(allowednames=(), directories=True)
Bases:
BaseCompleter
File completer class, optionally takes a list of allowed extensions
- class recline.vendor.argcomplete.completers.SuppressCompleter
Bases:
BaseCompleter
A completer used to suppress the completion of specific arguments
- suppress()
Decide if the completion should be suppressed
recline.vendor.argcomplete.exceptions module
- exception recline.vendor.argcomplete.exceptions.ArgcompleteException
Bases:
Exception
Exception raised when the shell argument completion process fails.
recline.vendor.argcomplete.finders module
- class recline.vendor.argcomplete.finders.CompletionFinder(argument_parser=None, always_complete_options=True, exclude=None, validator=None, print_suppressed=False, default_completer=<recline.vendor.argcomplete.completers.FilesCompleter object>, append_space=None)
Bases:
object
Inherit from this class if you wish to override any of the stages below. Otherwise, use
argcomplete.autocomplete()
directly (it’s a convenience instance of this class). It has the same signature asCompletionFinder.__call__()
.- collect_completions(active_parsers: List[ArgumentParser], parsed_args: Namespace, cword_prefix: str) List[str]
Visits the active parsers and their actions, executes their completers or introspects them to collect their option strings. Returns the resulting completions as a list of strings.
This method is exposed for overriding in subclasses; there is no need to use it directly.
- filter_completions(completions: List[str]) List[str]
De-duplicates completions and excludes those specified by
exclude
. Returns the filtered completions as a list.This method is exposed for overriding in subclasses; there is no need to use it directly.
- get_display_completions()
This function returns a mapping of completions to their help strings for displaying to the user.
- quote_completions(completions: List[str], cword_prequote: str, last_wordbreak_pos: int | None) List[str]
If the word under the cursor started with a quote (as indicated by a nonempty
cword_prequote
), escapes occurrences of that quote character in the completions, and adds the quote to the beginning of each completion. Otherwise, escapes all characters that bash splits words on (COMP_WORDBREAKS
), and removes portions of completions before the first colon if (COMP_WORDBREAKS
) contains a colon.If there is only one completion, and it doesn’t end with a continuation character (
/
,:
, or=
), adds a space after the completion.This method is exposed for overriding in subclasses; there is no need to use it directly.
- rl_complete(text, state)
Alternate entry point for using the argcomplete completer in a readline-based REPL. See also rlcompleter. Usage:
import argcomplete, argparse, readline parser = argparse.ArgumentParser() ... completer = argcomplete.CompletionFinder(parser) readline.set_completer_delims("") readline.set_completer(completer.rl_complete) readline.parse_and_bind("tab: complete") result = input("prompt> ")
- class recline.vendor.argcomplete.finders.ExclusiveCompletionFinder(argument_parser=None, always_complete_options=True, exclude=None, validator=None, print_suppressed=False, default_completer=<recline.vendor.argcomplete.completers.FilesCompleter object>, append_space=None)
Bases:
CompletionFinder
- recline.vendor.argcomplete.finders.default_validator(completion, prefix)
recline.vendor.argcomplete.io module
- recline.vendor.argcomplete.io.debug(*args)
- recline.vendor.argcomplete.io.mute_stderr()
- recline.vendor.argcomplete.io.mute_stdout()
- recline.vendor.argcomplete.io.warn(*args)
Prints args to standard error when running completions. This will interrupt the user’s command line interaction; use it to indicate an error condition that is preventing your completer from working.
recline.vendor.argcomplete.lexers module
- recline.vendor.argcomplete.lexers.split_line(line, point=None)
recline.vendor.argcomplete.shell_integration module
- recline.vendor.argcomplete.shell_integration.shellcode(executables, use_defaults=True, shell='bash', complete_arguments=None, argcomplete_script=None)
Provide the shell code required to register a python executable for use with the argcomplete module.
- Parameters:
executables (list(str)) – Executables to be completed (when invoked exactly with this name)
use_defaults (bool) – Whether to fallback to readline’s default completion when no matches are generated (affects bash only)
shell (str) – Name of the shell to output code for
complete_arguments (list(str) or None) – Arguments to call complete with (affects bash only)
argcomplete_script (str or None) – Script to call complete with, if not the executable to complete. If supplied, will be used to complete all passed executables.