Skip to content
Back to top
View this page
Edit this page

# 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)

  Provides the completion from the end of the line.

  Parameters:
    line str

      Line to complete

    return_line bool, 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.

    kwargs optional

      All other keyword arguments are passed to the bash_completions() function.

  Returns:
    rtn set 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)

  Completes based on results from BASH completion.

  Parameters:
    prefix str

      The string to match

    line str

      The line that prefix appears on.

    begidx int

      The index in line that prefix starts on.

    endidx int

      The index in line that prefix ends on.

    env Mapping, optional

      The environment dict to execute the Bash subprocess in.

    paths list or tuple of str or None, optional

      This is a list (or tuple) of strings that specifies where the `bash_completion` script and supplemental completion scripts may be found. The first valid `bash_completion` framework file will be used; non-framework files and files in directories are sourced after it. 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 package-managed individual completion scripts (like `.../completes/ssh`) do not need to be included here. The default values are platform dependent, but reasonable.

    command str or None, optional

      The /path/to/bash to use. If None, it will be selected based on the from the environment and platform.

    quote_paths callable, 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_args list 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_quote str, optional

      The current argument’s opening quote. This is passed to the quote_paths function.

    closing_quote str, optional

      The closing quote that should be used. This is also passed to the quote_paths function.

    arg_index int, optional

      The current prefix’s index in the args.

  Returns:
    rtn set of str

      Possible completions of prefix

    lprefix int

      Length of the prefix to be replaced in the completion.