summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-08-23 20:54:43 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-08-23 20:54:43 +0100
commit510a11834a8485cb9c3d55d73770b4f3710c7447 (patch)
treeecc79bab4f8d1649fe49407741676d9ccbf22320 /Completion/Unix/Command
parentdc9d994498e43c7fad833798a74ee0c2e4a4247d (diff)
parent4bab43d11d5ce60950e69e54ab5a677c15f13e0f (diff)
downloadzsh-510a11834a8485cb9c3d55d73770b4f3710c7447.tar.gz
zsh-510a11834a8485cb9c3d55d73770b4f3710c7447.tar.xz
zsh-510a11834a8485cb9c3d55d73770b4f3710c7447.zip
Fix merge
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/.distfiles1
-rw-r--r--Completion/Unix/Command/_chsh40
2 files changed, 41 insertions, 0 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index fe810e1c4..35d81b2d2 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -29,6 +29,7 @@ _cdrecord
 _chkconfig
 _chmod
 _chown
+_chsh
 _clay
 _comm
 _compress
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