about summary refs log tree commit diff
path: root/Completion/Core/_multi_parts
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_multi_parts')
-rw-r--r--Completion/Core/_multi_parts28
1 files changed, 12 insertions, 16 deletions
diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts
index e64e2906f..61bd3acaf 100644
--- a/Completion/Core/_multi_parts
+++ b/Completion/Core/_multi_parts
@@ -13,22 +13,18 @@ typeset -U tmp2
 
 # Get the options.
 
-group=()
-expl=()
-opts=()
-sopts=()
-while getopts "J:V:X:P:F:S:r:R:qM:12n" opt; do
-  case "$opt" in
-  [JV])   group=("-$opt" "$OPTARG");;
-  X)      expl=(-X "$OPTARG");;
-  [PF])   opts=( "$opts[@]" "-$opt" "$OPTARG")
-          sopts=( "$sopts[@]" "-$opt" "$OPTARG");;
-  [SrR])  sopts=( "$sopts[@]" -P "$OPTARG");;
-  [q12n]) sopts=( "$sopts[@]" "-$opt");;
-  M)      match="$OPTARG";;
-  esac
-done
-shift OPTIND-1
+zparseopts -D \
+    J:group V:group X:expl \
+    P:opts F:opts \
+    S:sopts r:sopts R:sopts qsopts 1sopts 2sopts nsopts \
+    M:match
+
+sopts=( "$sopts[@]" "$opts[@]" )
+if (( $#match )); then
+  match="${match[1][3,-1]}"
+else
+  match=''
+fi
 
 # Get the arguments, first the separator, then the array. The array is 
 # stored in `matches'. Further on this array will always contain those