diff --git a/CHANGES b/CHANGES index 75b8ca8c..fe0c24b6 100644 --- a/CHANGES +++ b/CHANGES @@ -24,7 +24,7 @@ bash-completion (2.x) * Apply cardctl completion to pccardctl too. * Apply pine completion to alpine too. * 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, vncviewer, and general hostname completions. * Add abook and wtf completion, based on work by Raphaƫl Droz. diff --git a/contrib/chsh b/contrib/chsh index 46ee029f..23e1500e 100644 --- a/contrib/chsh +++ b/contrib/chsh @@ -8,8 +8,19 @@ _chsh() cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} - if [ "$prev" = "-s" ]; then - _shells + case "$prev" in + --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 COMPREPLY=( $( compgen -u -- "$cur" ) ) fi