summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_su
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:32:59 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:58:59 +0200
commitdb38e167634b6c2217eec3a5aafc37c46d9e5a8d (patch)
treedaa342d423febbd3a5a7ef97053037677fab004a /Completion/Unix/Command/_su
parent01eea47617a6e06debdb4330f92ae69f92089fd2 (diff)
parent3c3c8d3d13fd4cf6c03f81ca8dc18a1efd561728 (diff)
downloadzsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.tar.gz
zsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_su')
-rw-r--r--Completion/Unix/Command/_su21
1 files changed, 16 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su
index 6d0f2cd9f..057a41371 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,21 @@ 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 +61,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]=