diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2014-08-26 00:48:18 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2014-08-26 00:48:18 +0200 |
commit | a55d381f745d669c0ef9bdf0a4ce78a045ff3070 (patch) | |
tree | 31c741d92f2077f241835005b8cfd1db251445f6 /Completion/Unix/Command/_chsh | |
parent | 478d6c1db2ad16ea6b3cb6010cf083f2513494cf (diff) | |
parent | cc69eef1cd835cd8d3f33960e9f616c894e7ae4f (diff) | |
download | zsh-a55d381f745d669c0ef9bdf0a4ce78a045ff3070.tar.gz zsh-a55d381f745d669c0ef9bdf0a4ce78a045ff3070.zip |
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_chsh')
-rw-r--r-- | Completion/Unix/Command/_chsh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_chsh b/Completion/Unix/Command/_chsh new file mode 100644 index 000000000..97552e3ac --- /dev/null +++ b/Completion/Unix/Command/_chsh @@ -0,0 +1,40 @@ +#compdef chsh chpass +case $OSTYPE in +(darwin*|*bsd*) + _arguments : \ + '-s[Specify user login shell]:shell:(${(Z+Cn+)"$(</etc/shells)"})' \ + "-l[Specify location of user]:node:" \ + "-u[Specify authentication name]:auth user:" \ + "1:user name:_users" + ;; +(linux-gnu) + if { =chsh -v } >&/dev/null + then + local -a opts shells + shells=( $(=chsh -l) ) + _arguments : \ + "(-)-s[Specify your login shell]:shell:($shells)" \ + "(-)--shell[Specify your login shell]:shell:($shells)" \ + "(-)-l[Print shells in /etc/shells]" \ + "(-)--list-shells[Print shells in /etc/shells]" \ + "(-)-u[Print a usage message and exit]" \ + "(-)--help[Print a usage message and exit]" \ + "(-)-v[Print version information and exit]" \ + "(-)--version[Print version information and exit]" \ + "1:user name:_users" + return + fi + # else fall through + ;& +(*) + local s='' + # Use $s to cause all options to be treated as mutually exclusive + [[ $words[CURRENT-1] = -* ]] && s="(-)$words[CURRENT-1]" + # This fiddling with $s is a hack to cause "_arguments : --" to use + # the /etc/shells listing for -s or --shell even when the description + # of that option has been pulled from the GNU --help output. + [[ $words[CURRENT-1] = (-s|--shell) ]] && + s="$s"'[ ]:shell:(${(Z+Cn+)"$(</etc/shells)"})' + _arguments : $s "1:user name:_users" -- + ;; +esac |