about summary refs log tree commit diff
path: root/Completion/Unix/Command/_su
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-21 20:53:51 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-21 20:53:51 +0200
commit5e592fd9b0d0d5a0532ffa57667b3f5e7c09fa92 (patch)
tree2af5203a95aac5a327f8cd7fd9e9a4e1f207192a /Completion/Unix/Command/_su
parentaf9f623273eb994d36d3f02ed37bac6edb10c7cb (diff)
downloadzsh-5e592fd9b0d0d5a0532ffa57667b3f5e7c09fa92.tar.gz
zsh-5e592fd9b0d0d5a0532ffa57667b3f5e7c09fa92.tar.xz
zsh-5e592fd9b0d0d5a0532ffa57667b3f5e7c09fa92.zip
33485: fixes for zstyle context handling
Diffstat (limited to 'Completion/Unix/Command/_su')
-rw-r--r--Completion/Unix/Command/_su20
1 files changed, 15 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su
index 6d0f2cd9f..9d3f28066 100644
--- a/Completion/Unix/Command/_su
+++ b/Completion/Unix/Command/_su
@@ -1,9 +1,9 @@
 #compdef su
 
 local -A opt_args
-local -a args state context
+local -a args context state line expl
 local shell=${words[(i)(-s|--shell=*)]} first='1:user name:_users'
-local usr=root line
+local usr=root
 
 if _pick_variant gnu="Free Software Foundation" unix --version; then
   args=(
@@ -20,10 +20,20 @@ if _pick_variant gnu="Free Software Foundation" unix --version; then
   )
 else
   args=(
-    '-c[pass command to shell]:command string:->command'
     '-l[use a login shell]'
     '-s[run the specified shell]:shell:->shell'
   )
+  case $OSTYPE in
+  freebsd*)
+    args=(
+      '-c[use settings from specified login class]:class'
+      '-f[if the invoked shell is csh, prevent it from reading .cshrc]'
+      '-l[use a login shell]'
+      '-m[do not reset environment]'
+      '-s[set the MAC label]'
+    )
+  *) args+=( '-c[pass command to shell]:command string:->command' ) ;;
+  esac
 fi
 
 if [[ $#words -ge 2 && $words[2] != -* && CURRENT -ne 2 ]]; then
@@ -50,11 +60,11 @@ case $state in
         return
         ;;
     (shell)
-        compadd ${(f)^"$(</etc/shells)"}(N)
+        _wanted -C $context shells expl shell compadd ${(f)^"$(</etc/shells)"}(N)
         return
         ;;
     (rest)
-        if [[ -z $shell || $shell = */nologin ]]; then
+        if [[ -z $shell || $shell = */(nologin|false) ]]; then
             _arguments "-s[run the specified shell, $usr has no shell]" ||
                 _message "-s option required, $usr has no shell"
             compstate[insert]=