Where can I find documentation for _get_comp_words_by_ref function used often in autocompletion scripts?

Viewed 781

I am trying to write tests for a bash completion script a user of a tool I am developing wrote (so that I can keep it up to date with the tool itself) and I am wondering what the _get_comp_words_by_ref exactly does.

Sample:

local cur prev
if type _get_comp_words_by_ref &>/dev/null ; then
    _get_comp_words_by_ref cur prev
else
    cur=$2 prev=$3
fi
1 Answers

It's part of the bash-completions package, which might be installed in the directory /usr/share/bash-completion (although the precise path depends on the distro).

There's a nice long comment in the top-level file bash-completion, which contains a number of utility functions.

Related