about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-03-15 19:35:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-03-15 19:35:26 +0000
commit7f3590c68fa37812a4f79ceb5a41bdd7ca565067 (patch)
treee040419fc4d5e59a939109d2b8434a00f632ab21
parentec3f3e9eeceaaf694e5dfbe15d07d11a304fd944 (diff)
downloadzsh-7f3590c68fa37812a4f79ceb5a41bdd7ca565067.tar.gz
zsh-7f3590c68fa37812a4f79ceb5a41bdd7ca565067.tar.xz
zsh-7f3590c68fa37812a4f79ceb5a41bdd7ca565067.zip
Alexey: 27789: use _arguments in _sudo
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_sudo25
2 files changed, 16 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 34171de9f..97705d86b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-15  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Alexey: 27789: Completion/Unix/Command/_sudo: use _arguments.
+
 2010-03-15  Peter Stephenson  <pws@csr.com>
 
 	* 27780: Completion/Unix/Type/_files, Test/D04parameter.ztst:
@@ -12896,5 +12900,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4929 $
+* $Revision: 1.4930 $
 *****************************************************
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 23afb4046..384e9358b 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -25,21 +25,18 @@ args=(
        '-S[read password from stdin]'
 )
 
-if [[ $service = sudoedit || -n $words[(R)-e] ]]; then
-  args+=(
+if [[ $service = sudoedit ]]; then
+  _arguments $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 $args \
+    '(- :)-e[edit file]:*:file:_files' \
+    '(- :)-s[run SHELL]' \
+    '(- :)-i[simulate login]' \
+    '(-i -s -e)-b[run command in background]' \
+    '(-i -s -e)-E[preserve environment]' \
+    '(-i -s -e)-H[set HOME environment variable]' \
+    '(-i -s -e)-P[preserve group vector]' \
+    '(-):command: _command_names -e' \
     '*::arguments: _normal'
-  )
 fi
-
-_arguments $args