about summary refs log tree commit diff
path: root/Completion/Core/_alternative
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:46 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:46 +0000
commit35b2633ad941966f5fca07b625a594a5b68c0fdb (patch)
treeb54740d014e594ba5d81931cdcdb3387bcf9dfca /Completion/Core/_alternative
parentbb98460a01ce1f6c1e71f7e401f782c81b71486b (diff)
downloadzsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.gz
zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.xz
zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.zip
manual/8639
Diffstat (limited to 'Completion/Core/_alternative')
-rw-r--r--Completion/Core/_alternative21
1 files changed, 11 insertions, 10 deletions
diff --git a/Completion/Core/_alternative b/Completion/Core/_alternative
index f13fc9e5a..76a8380bc 100644
--- a/Completion/Core/_alternative
+++ b/Completion/Core/_alternative
@@ -1,22 +1,23 @@
 #autoload
 
 local tags def expl descr action mesgs nm="$compstack[nmatches]" subopts
+local opt curcontext="$curcontext"
+
+subopts=()
+while getopts 'O:C:' opt; do
+  case "$opt" in
+  O) subopts=( "${(@P)OPTARG}" ) ;;
+  C) curcontext="${curontext}:$OPTARG" ;;
+  esac
+done
 
-if [[ "$1" = -O?* ]]; then
-  subopts=( "${(@P)1[3,-1]}" )
-  shift
-elif [[ "$1" = -O ]]; then
-  subopts=( "${(@P)2}" )
-  shift 2
-else
-  subopts=()
-fi  
+shift OPTIND-1
 
 [[ "$1" = -(|-) ]] && shift
 
 mesgs=()
 
-_tags "$1" "${(@)argv[2,-1]%%:*}"
+_tags "${(@)argv%%:*}"
 
 while _tags; do
   for def; do