Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/4] _normal: Use zparseopts
- X-seq: zsh-workers 44199
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/4] _normal: Use zparseopts
- Date: Mon, 1 Apr 2019 22:06:32 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=W1qytAiCkM2zPIu1S5WlCFK+W6t5sXq+nrK8C3RgytQ=; b=BGiyZbQTw9SwdhigPHjkJWgTZKWZYV3Wzb43PaikYkfRhGV+xy5nY2tiIYV0doMIMh NX0OmLf/7w1I6VWnVTzhQiS2x+MeeyacYMGlGeCBXp0WWTJWZyFDFgUCEnvc7OZlDVNB 3TcnvS8HYx+P3+Pjhz369IMbsvWG8Pgmk5ecc4mL4A3l1NvlTdQ3s/SHJlebK19whRgX hKoHcD7a2dCQXFyYbxiE0Y324ytwX8keLnF+o/LfqdpEAj2ocECNPcrGsuy6SP2Q0RJT zPhTub2tvHuJl0JCaGce6gaCROUtXpMZJ5RMTu9JdZcLgPWV8pD/ZokWBb2o78cvkQH3 zZ4Q==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Use zparseopts in preparation for later diffs adding -p and -P.
---
Completion/Base/Core/_normal | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/Completion/Base/Core/_normal b/Completion/Base/Core/_normal
index dd607d2b2..fe336e303 100644
--- a/Completion/Base/Core/_normal
+++ b/Completion/Base/Core/_normal
@@ -1,13 +1,10 @@
#compdef -command-line-
-local _comp_command1 _comp_command2 _comp_command skip
+local _comp_command1 _comp_command2 _comp_command
+local -A opts
-if [[ "$1" = -s ]]; then
- skip=(-s)
-else
- skip=()
- _compskip=''
-fi
+zparseopts -A opts -D - s
+(( $+opts[-s] )) || _compskip=
# Check for a history reference to complete modifiers.
# $PREFIX has a quoted form of the !, so we can't test that
@@ -37,5 +34,5 @@ fi
_set_command
-_dispatch "$skip[@]" "$_comp_command" \
+_dispatch ${(k)opts[-s]} "$_comp_command" \
"$_comp_command1" "$_comp_command2" -default-
--
2.21.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author