about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-05-08 08:42:05 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-05-08 08:42:05 +0000
commitb2176aa525517dd17827c06a6b9c38db08628b52 (patch)
treee7f6742064eb3a1101dab4c89d9e5bbc6ac08534
parent61951605986a6bfb7fb3bd005105362d2def400f (diff)
downloadzsh-b2176aa525517dd17827c06a6b9c38db08628b52.tar.gz
zsh-b2176aa525517dd17827c06a6b9c38db08628b52.tar.xz
zsh-b2176aa525517dd17827c06a6b9c38db08628b52.zip
update _sudo
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_sudo55
2 files changed, 40 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c289f00e..3e9439d63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-05-08  Peter Stephenson  <pws@csr.com>
 
+	* 26949: Completion/Unix/Command/_sudo: new options and sudoedit.
+
 	* 26948: Src/Zle/zle_refresh.c: ensure recorded window sizes
 	are reset when video data is freed.
 
@@ -11671,5 +11673,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4679 $
+* $Revision: 1.4680 $
 *****************************************************
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index b4c002168..23afb4046 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -1,26 +1,45 @@
-#compdef sudo
+#compdef sudo sudoedit
 
 local curcontext="$curcontext" environ e
+local -a args
+
 zstyle -a "$curcontext" environ environ
 
 for e in "${environ[@]}"
 do local -x "$e"
 done
 
-_arguments \
-       '-V[show version]' \
-       '-l[list allowed commands]' \
-       '-L[list options from Default section]' \
-       '-h[show help]' \
-       '-v[validate user timestamp]' \
-       '-k[invalidate user timestamp]' \
-       '-K[remove user timestamp]' \
-       '-b[run command in background]' \
-       '-r[Kerberos realm]:Kerberos realm:' \
-       '-p[password prompt]:password prompt:' \
-       '-u[user name]:user name:_users' \
-       '-s[run SHELL]' \
-       '-H[set HOME environment variable]' \
-       '-S[read password from stdin]' \
-       '(-):command name: _command_names -e'  \
-       '*::arguments: _normal'
+args=(
+       '-V[show version]'
+       '-l[list allowed commands]'
+       '-L[list options from Default section]'
+       '-a[BSD auth type]:BSD auth type:'
+       '-c[BSD login class]:BSD login class:'
+       '-h[show help]'
+       '-v[validate user timestamp]'
+       '-k[invalidate user timestamp]'
+       '-K[remove user timestamp]'
+       '-r[Kerberos realm]:Kerberos realm:'
+       '-p[password prompt]:password prompt:'
+       '-u[user name]:user name:_users'
+       '-S[read password from stdin]'
+)
+
+if [[ $service = sudoedit || -n $words[(R)-e] ]]; then
+  args+=(
+    '*:file: _files'
+  )
+else
+  args+=(
+    '-b[run command in background]'
+    '-E[preserve environment]'
+    '-H[set HOME environment variable]'
+    '-P[preserve group vector]'
+    '(-i)-s[run SHELL]'
+    '(-s)-i[simulate login]'
+    '(-):command name: _command_names -e'
+    '*::arguments: _normal'
+  )
+fi
+
+_arguments $args