summaryrefslogtreecommitdiff
path: root/contrib/chsh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/chsh')
-rw-r--r--contrib/chsh18
1 files changed, 14 insertions, 4 deletions
diff --git a/contrib/chsh b/contrib/chsh
index 46ee029f..1af3630f 100644
--- a/contrib/chsh
+++ b/contrib/chsh
@@ -5,11 +5,21 @@ _chsh()
local cur prev
COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
- 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