Add GNU chsh option completions.

This commit is contained in:
Ville Skyttä 2009-12-26 12:31:26 +02:00
parent 329890a73b
commit c6e9334cfa
2 changed files with 14 additions and 3 deletions

View File

@ -24,7 +24,7 @@ bash-completion (2.x)
* Apply cardctl completion to pccardctl too. * Apply cardctl completion to pccardctl too.
* Apply pine completion to alpine too. * Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist. * Remove many unnecessary short option completions where long ones exist.
* Improve configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer, * Improve chsh, configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer,
mysqladmin, rsync, screen, service, scp, ssh, update-alternatives, mysqladmin, rsync, screen, service, scp, ssh, update-alternatives,
vncviewer, and general hostname completions. vncviewer, and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz. * Add abook and wtf completion, based on work by Raphaël Droz.

View File

@ -8,8 +8,19 @@ _chsh()
cur=`_get_cword` cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "$prev" = "-s" ]; then case "$prev" in
_shells --list-shells|--help|-v|--version)
return 0
;;
-s|--shell)
_shells
return 0
;;
esac
if [[ "$cur" == -* && "$( uname -s )" == @(Linux|GNU|GNU/*) ]]; then
COMPREPLY=( $( compgen -W '--shell --list-shells --help --version' \
-- "$cur" ) )
else else
COMPREPLY=( $( compgen -u -- "$cur" ) ) COMPREPLY=( $( compgen -u -- "$cur" ) )
fi fi