Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Do not look into $words for options, use _arguments powers instead
- X-seq: zsh-workers 27789
- From: "Alexey I. Froloff" <raorn@xxxxxxxxxxxx>
- To: Zsh list <zsh-workers@xxxxxxx>
- Subject: [PATCH] Do not look into $words for options, use _arguments powers instead
- Date: Fri, 12 Mar 2010 18:12:58 +0300
- Cc: "Alexey I. Froloff" <raorn@xxxxxxxxxxxx>
- In-reply-to: <091121103311.ZM16872@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <091121103311.ZM16872@xxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Alexey I. Froloff <raorn@xxxxxxxxxxxx>
---
Completion/Unix/Command/_sudo | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 23afb40..384e935 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
--
1.6.6.2
Messages sorted by:
Reverse Date,
Date,
Thread,
Author