Add cvs --help command completion, get commands from --help-commands,

offer the few long options there are rather than corresponding short
ones.
This commit is contained in:
Ville Skyttä 2009-10-20 09:29:36 +03:00
parent 52c8a81b31
commit 70fd9ca2df
2 changed files with 13 additions and 9 deletions

View File

@ -15,7 +15,7 @@ bash-completion (1.x)
* Apply cardctl completion to pccardctl too.
* Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist.
* Improve gkrellm, mdadm, and mysqladmin completions.
* Improve cvs, gkrellm, mdadm, and mysqladmin completions.
* Add wtf completion, based on work by Raphaël Droz.
-- David Paleino <d.paleino@gmail.com> Sun, 11 Oct 2009 11:11:57 +0200

View File

@ -23,6 +23,11 @@ get_modules()
fi
}
_cvs_commands()
{
cvs --help-commands 2>&1 | awk '/^ / { print $1 }'
}
_cvs()
{
local cur count mode i cvsroot cvsroots pwd
@ -40,6 +45,10 @@ _cvs()
fi
if [ -z "$mode" ]; then
case $i in
-H|--help)
COMPREPLY=( $( compgen -W "$( _cvs_commands )" -- "$cur" ) )
return 0
;;
-d)
mode=cvsroot
cvsroot=${COMP_WORDS[((count+1))]}
@ -239,14 +248,9 @@ _cvs()
fi
;;
"")
COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
commit diff delete edit export \
freeze get history import log new \
patch rcs rdiff release remove \
rfreeze rlog rm rtag stat status \
tag unedit up update -H -Q -q -b \
-d -e -f -l -n -t -r -v -w -x -z \
--help --version' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _cvs_commands ) \
-Q -q -b -d -e -f -l -n -t -r -w -x -z \
--help --help-commands --help-options --version' -- "$cur" ) )
;;
*)
;;