mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
18526: -O option to _describe for prefix-needed in _arguments
This commit is contained in:
parent
4018e3c149
commit
ecdfa912ae
4 changed files with 22 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2003-06-05 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* 18526 tweaked (c.f. 18527): Completion/Base/Utility/_arguments,
|
||||||
|
Completion/Base/Utility/_describe, Doc/Zsh/compsys.yo:
|
||||||
|
fix use of style prefix-needed in _arguments by adding an
|
||||||
|
option -O to _describe.
|
||||||
|
|
||||||
2003-06-03 Peter Stephenson <pws@csr.com>
|
2003-06-03 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
* 18600: Src/pattern.c: bug matching against [[:xdigit:]].
|
* 18600: Src/pattern.c: bug matching against [[:xdigit:]].
|
||||||
|
|
|
@ -387,7 +387,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
|
tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
|
||||||
tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
|
tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
|
||||||
|
|
||||||
_describe -o option \
|
_describe -O option \
|
||||||
tmp1 tmp2 -Q -S '' -- \
|
tmp1 tmp2 -Q -S '' -- \
|
||||||
tmp3 -Q
|
tmp3 -Q
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
single=yes
|
single=yes
|
||||||
else
|
else
|
||||||
next=( "$next[@]" "$odirect[@]" )
|
next=( "$next[@]" "$odirect[@]" )
|
||||||
_describe -o option \
|
_describe -O option \
|
||||||
next -Q -M "$matcher" -- \
|
next -Q -M "$matcher" -- \
|
||||||
direct -QS '' -M "$matcher" -- \
|
direct -QS '' -M "$matcher" -- \
|
||||||
equal -QqS= -M "$matcher"
|
equal -QqS= -M "$matcher"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# This can be used to add options or values with descriptions as matches.
|
# 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 _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
|
||||||
local csl="$compstate[list]" csl2
|
local csl="$compstate[list]" csl2
|
||||||
local _oargv _argv _new _strs _mats _opts _i _try=0
|
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
|
if [[ "$1" = -o ]]; then
|
||||||
_type=options
|
_type=options
|
||||||
shift
|
shift
|
||||||
|
elif [[ "$1" = -O ]]; then
|
||||||
|
_type=options
|
||||||
|
_noprefix=1
|
||||||
|
shift
|
||||||
elif [[ "$1" = -t ]]; then
|
elif [[ "$1" = -t ]]; then
|
||||||
_type="$2"
|
_type="$2"
|
||||||
shift 2
|
shift 2
|
||||||
|
@ -20,6 +24,10 @@ elif [[ "$1" = -t* ]]; then
|
||||||
shift
|
shift
|
||||||
fi
|
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.
|
# Do the tests. `showd' is set if the descriptions should be shown.
|
||||||
|
|
||||||
zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes
|
zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes
|
||||||
|
|
|
@ -3665,7 +3665,7 @@ tt(compadd) when generating matches from the style value, or to
|
||||||
the functions for the fields if they are called.
|
the functions for the fields if they are called.
|
||||||
)
|
)
|
||||||
findex(_describe)
|
findex(_describe)
|
||||||
item(tt(_describe) [ tt(-o) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
|
item(tt(_describe) [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
|
||||||
This function associates completions with descriptions.
|
This function associates completions with descriptions.
|
||||||
Multiple groups separated by tt(-)tt(-) can be supplied, potentially with
|
Multiple groups separated by tt(-)tt(-) can be supplied, potentially with
|
||||||
different completion options var(opts).
|
different completion options var(opts).
|
||||||
|
@ -3688,7 +3688,9 @@ line. In this case tt(_describe) uses the tt(prefix-hidden),
|
||||||
tt(prefix-needed) and tt(verbose) styles to find out if the strings should
|
tt(prefix-needed) and tt(verbose) styles to find out if the strings should
|
||||||
be added as completions and if the descriptions should be shown. Without
|
be added as completions and if the descriptions should be shown. Without
|
||||||
the `tt(-o)' option, only the tt(verbose) style is used to decide how
|
the `tt(-o)' option, only the tt(verbose) style is used to decide how
|
||||||
descriptions are shown.
|
descriptions are shown. If `tt(-O)' is used instead of `tt(-O)', command
|
||||||
|
options are completed as above but tt(_describe) will not handle the
|
||||||
|
tt(prefix-needed) style.
|
||||||
|
|
||||||
With the tt(-t) option a var(tag) can be specified. The default is
|
With the tt(-t) option a var(tag) can be specified. The default is
|
||||||
`tt(values)' or, if the tt(-o) option is given, `tt(options)'.
|
`tt(values)' or, if the tt(-o) option is given, `tt(options)'.
|
||||||
|
|
Loading…
Reference in a new issue