xonsh.completers.bash_completion¶
This module provides the implementation for the retrieving completion results from bash.
- xonsh.completers.bash_completion.bash_complete_line(line, return_line=True, **kwargs)[source]¶
Provides the completion from the end of the line.
- Parameters:
- linestr
Line to complete
- return_linebool, optional
If true (default), will return the entire line, with the completion added. If false, this will instead return the strings to append to the original line.
- kwargsoptional
All other keyword arguments are passed to the bash_completions() function.
- Returns:
- rtnset of str
Possible completions of prefix
- xonsh.completers.bash_completion.bash_completions(prefix, line, begidx, endidx, env=None, paths=None, command=None, quote_paths=<function _bash_quote_paths>, line_args=None, opening_quote='', closing_quote='', arg_index=None, **kwargs)[source]¶
Completes based on results from BASH completion.
- Parameters:
- prefixstr
The string to match
- linestr
The line that prefix appears on.
- begidxint
The index in line that prefix starts on.
- endidxint
The index in line that prefix ends on.
- envMapping, optional
The environment dict to execute the Bash subprocess in.
- pathslist or tuple of str or None, optional
This is a list (or tuple) of strings that specifies where the
bash_completion
script may be found. The first valid path will be used. For better performance, bash-completion v2.x is recommended since it lazy-loads individual completion scripts. For both bash-completion v1.x and v2.x, paths of individual completion scripts (like.../completes/ssh
) do not need to be included here. The default values are platform dependent, but reasonable.- commandstr or None, optional
The /path/to/bash to use. If None, it will be selected based on the from the environment and platform.
- quote_pathscallable, optional
A functions that quotes file system paths. You shouldn’t normally need this as the default is acceptable 99+% of the time. This function should return a set of the new paths and a boolean for whether the paths were quoted.
- line_argslist of str, optional
A list of the args in the current line to be used instead of
line.split()
. This is usefull with a space in an argument, e.g.ls 'a dir/'<TAB>
.- opening_quotestr, optional
The current argument’s opening quote. This is passed to the quote_paths function.
- closing_quotestr, optional
The closing quote that should be used. This is also passed to the quote_paths function.
- arg_indexint, optional
The current prefix’s index in the args.
- Returns:
- rtnset of str
Possible completions of prefix
- lprefixint
Length of the prefix to be replaced in the completion.