diff options
-rw-r--r-- | Completion/Base/_arguments | 26 | ||||
-rw-r--r-- | Completion/Pbmplus/_pnmtotiff | 2 | ||||
-rw-r--r-- | Completion/Pbmplus/_ppmtomitsu | 2 | ||||
-rw-r--r-- | Completion/User/_find | 4 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 6 |
5 files changed, 35 insertions, 5 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index 60b07b2e4..5deef344b 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -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. diff --git a/Completion/Pbmplus/_pnmtotiff b/Completion/Pbmplus/_pnmtotiff index 5cc170190..af7cb14ac 100644 --- a/Completion/Pbmplus/_pnmtotiff +++ b/Completion/Pbmplus/_pnmtotiff @@ -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' diff --git a/Completion/Pbmplus/_ppmtomitsu b/Completion/Pbmplus/_ppmtomitsu index e89047df1..16103f558 100644 --- a/Completion/Pbmplus/_ppmtomitsu +++ b/Completion/Pbmplus/_ppmtomitsu @@ -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' diff --git a/Completion/User/_find b/Completion/User/_find index 368cdcb16..4fe84a83a 100644 --- a/Completion/User/_find +++ b/Completion/User/_find @@ -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' \ diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index e1cca1337..f3703acda 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -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) |