about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-06-05 09:51:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-06-05 09:51:25 +0000
commitecdfa912ae9dc5bd7d98160ab88ae4f17fe761b1 (patch)
treecde3d39a4d0d2b6e5064360cea308589d0c17fef /Completion
parent4018e3c1493ea415ef9ad5eba83ad153263d3371 (diff)
downloadzsh-ecdfa912ae9dc5bd7d98160ab88ae4f17fe761b1.tar.gz
zsh-ecdfa912ae9dc5bd7d98160ab88ae4f17fe761b1.tar.xz
zsh-ecdfa912ae9dc5bd7d98160ab88ae4f17fe761b1.zip
18526: -O option to _describe for prefix-needed in _arguments
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Utility/_arguments4
-rw-r--r--Completion/Base/Utility/_describe10
2 files changed, 11 insertions, 3 deletions
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index fe8edd61a..44be6db84 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -387,7 +387,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
 	    tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
 	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
-            _describe -o option \
+            _describe -O option \
                       tmp1 tmp2 -Q -S '' -- \
 		      tmp3 -Q
 
@@ -399,7 +399,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
           single=yes
         else
           next=( "$next[@]" "$odirect[@]" )
-          _describe -o option \
+          _describe -O option \
                     next -Q -M "$matcher" -- \
                     direct -QS '' -M "$matcher" -- \
                     equal -QqS= -M "$matcher"
diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe
index eafdcc35b..d5d7aeba7 100644
--- a/Completion/Base/Utility/_describe
+++ b/Completion/Base/Utility/_describe
@@ -2,7 +2,7 @@
 
 # This can be used to add options or values with descriptions as matches.
 
-local _opt _expl _tmpm _tmpd _mlen
+local _opt _expl _tmpm _tmpd _mlen _noprefix
 local _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
 local csl="$compstate[list]" csl2
 local _oargv _argv _new _strs _mats _opts _i _try=0
@@ -12,6 +12,10 @@ local _oargv _argv _new _strs _mats _opts _i _try=0
 if [[ "$1" = -o ]]; then
   _type=options
   shift
+elif [[ "$1" = -O ]]; then
+  _type=options
+  _noprefix=1
+  shift
 elif [[ "$1" = -t ]]; then
   _type="$2"
   shift 2
@@ -20,6 +24,10 @@ elif [[ "$1" = -t* ]]; then
   shift
 fi
 
+[[ "$_type$_noprefix" = options && ! -prefix [-+]* ]] && \
+    zstyle -T ":completion:${curcontext}:options" prefix-needed &&
+        return 1
+
 # Do the tests. `showd' is set if the descriptions should be shown.
 
 zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes