[Bash-completion-devel] _get_comp_words_by_ref
Freddy Vulto
fvulto at gmail.com
Sun Mar 14 10:21:36 UTC 2010
On 100210 21:48, Freddy Vulto wrote:
> Maybe we can make the varnames non-optional, and also provide shortcuts by
> using the arguments, indicating which fixed varnames to return:
Done so in commit bdca37a in branch `use-_get_comp_words_by_ref':
Improve _get_comp_words_by_ref to return `words' and `cword':
Usage: _get_comp_words_by_ref [OPTIONS] [VARNAMES]
Available VARNAMES:
cur Return cur within varname "cur"
prev Return prev within varname "prev"
words Return words within varname "words"
cword Return cword within varname "cword"
Available OPTIONS:
-n EXCLUDE Characters out of $COMP_WORDBREAKS which should NOT be
considered word breaks. This is useful for things like scp
where we want to return host:path and not only path, so we
would pass the colon (:) as -n option in this case. Bash-3
doesn't do word splitting, so this ensures we get the same
word on both bash-3 and bash-4.
-c VARNAME Return cur within specified VARNAME
-p VARNAME Return prev within specified VARNAME
-w VARNAME Return words within specified VARNAME
-i VARNAME Return cword within specified VARNAME
Example usage:
$ _get_comp_words_by_ref -n : cur words cword
Greetings,
Freddy Vulto
http://fvue.nl
More information about the Bash-completion-devel
mailing list