about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2019-04-04 18:45:19 -0500
committerMatthew Martin <phy1729@gmail.com>2019-04-04 18:45:19 -0500
commitbb790c8f8118d4428d8effc65b1c5dc03d1637f6 (patch)
tree043a6fc97f2f1174ed4869f0eba3f51d189a506a
parentc749a06bc9f15b5153d55b7f5e6f9a3a252e39f6 (diff)
downloadzsh-bb790c8f8118d4428d8effc65b1c5dc03d1637f6.tar.gz
zsh-bb790c8f8118d4428d8effc65b1c5dc03d1637f6.tar.xz
zsh-bb790c8f8118d4428d8effc65b1c5dc03d1637f6.zip
44199: _normal: Use zparseopts
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Base/Core/_normal13
2 files changed, 9 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 973b8a920..1074d6a54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-04-04  Matthew Martin  <phy1729@gmail.com>
+
+	* 44199: Completion/Base/Core/_normal: Use zparseopts.
+
 2019-04-01  dana  <dana@dana.is>
 
 	* 44158 (tweaked): Completion/Unix/Command/_postgresql: Add
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-