From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: [PATCH 1/4] _normal: Use zparseopts
Date: Mon, 1 Apr 2019 22:06:32 -0500 [thread overview]
Message-ID: <20190402030629.GA36265@CptOrmolo.darkstar> (raw)
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
reply other threads:[~2019-04-02 3:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190402030629.GA36265@CptOrmolo.darkstar \
--to=phy1729@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).