1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-12-07 18:11:20 +01:00

zsh-workers/7515

This commit is contained in:
Tanaka Akira 1999-08-27 12:02:50 +00:00
parent 98de79a703
commit 0161b1ca77
5 changed files with 35 additions and 5 deletions

View file

@ -533,8 +533,34 @@ else
if [[ -z "$action" ]]; then
# An empty action means that we should just display a message.
_message "$descr"
return ret
elif [[ "$action" = \(\(*\)\) ]]; then
# ((...)) contains literal strings with descriptions.
eval ws\=\( "${action[3,-3]}" \)
compadd -D ws - "${(@)ws%%:*}"
if (( $#ws )); then
beg=1
for nth in "$ws[@]"; do
tmp="${#nth%%:*}"
[[ tmp -gt beg ]] && beg="$tmp"
done
tmp=''
for nth in "$ws[@]"; do
tmp="$tmp
${(r:beg:: :)nth%%:*} -- ${nth#*:}"
done
tmp="$tmp[2,-1]"
compadd "$expl[@]" -y tmp - "${(@)ws%%:*}"
else
_message "$descr"
fi
elif [[ "$action" = \(*\) ]]; then
# Anything inside `(...)' is added directly.

View file

@ -1,5 +1,5 @@
#compdef pnmtotiff
_arguments '-none' '-packbits' '-lzw' '-g3' '-g4' '-2d' '-fill' \
'-predictor:LZW predictor:(1 2)' '-msb2lsb' '-lsb2msb' \
'-predictor:LZW predictor:((1\:without\ differencing 2\:with\ differencing))' '-msb2lsb' '-lsb2msb' \
'-rowsperstrip:number of rows per strip:' ':file: _pbm_file'

View file

@ -2,6 +2,6 @@
_arguments '-sharpness:sharpness:(1 2 3 4)' \
'-enlarge:enlargement factor:(1 2 3)' \
'-media:output media:(A A4 AS A4S)' \
'-media:output media (default\: 1184x1350):((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \
'-copy:number of copies:(1 2 3 4 5 6 7 8 9)' \
'-dpi300' '-tiny' ':file: _pbm_file'

View file

@ -43,8 +43,8 @@ _arguments \
'*-perm:file permission bits:' \
'*-size:file size:' \
'*-true' \
'*-type:file type:(b c d p f l s)' \
'*-xtype:file type:(b c d p f l s)' \
'*-type:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))' \
'*-xtype:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))' \
'*-exec:program: _command_names -e:*\;::program arguments: _normal' \
'*-ok:program: _command_names -e:*\;::program arguments: _normal' \
'*-fls:output file:_files' \

View file

@ -949,7 +949,11 @@ enditem()
In each of the cases above, the var(action) says how the possible
completions should be generated. In cases where only one of a fixed
set of strings can be completed, these string can directly be given as
a list in parentheses, as in `tt(:foo:(foo bar baz))'. A string in
a list in parentheses, as in `tt(:foo:(foo bar baz))'. Such a list in
doubled parentheses, as in `tt(:foo:((a\:bar b\:baz)))' should contain
strings consisting of the string to complete followed by a colon
(which needs to be preceded by a backslash) and a description. The
matches will be listed together with their descriptions. A string in
braces will be evaluated to generate the matches and if the
var(action) does not begin with an opening parentheses or brace, it
will be split into separate words and executed. If the var(action)