#compdef chsh chpass case $OSTYPE in (darwin*) _arguments : \ '-s[specify user login shell]:shell:(${(Z+Cn+)"$(&/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+)"$(