diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Core/_description | 32 | ||||
-rw-r--r-- | Completion/Base/Utility/_describe | 4 | ||||
-rw-r--r-- | Completion/Base/Utility/_guard | 2 | ||||
-rw-r--r-- | Completion/Base/Utility/_multi_parts | 4 | ||||
-rw-r--r-- | Completion/Base/Utility/_sep_parts | 4 | ||||
-rw-r--r-- | Completion/Base/Utility/_sequence | 3 | ||||
-rw-r--r-- | Completion/Darwin/Type/_mac_files_for_application | 2 | ||||
-rw-r--r-- | Completion/Redhat/Command/_yum | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 14 | ||||
-rw-r--r-- | Completion/Unix/Type/_baudrates | 7 | ||||
-rw-r--r-- | Completion/Unix/Type/_canonical_paths | 7 | ||||
-rw-r--r-- | Completion/Unix/Type/_files | 2 | ||||
-rw-r--r-- | Completion/Unix/Type/_list_files | 2 | ||||
-rw-r--r-- | Completion/Unix/Type/_path_files | 4 | ||||
-rw-r--r-- | Completion/Zsh/Command/_compadd | 12 | ||||
-rw-r--r-- | Completion/Zsh/Type/_file_descriptors | 2 |
16 files changed, 56 insertions, 47 deletions
diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description index 304c747a6..c2a0e080b 100644 --- a/Completion/Base/Core/_description +++ b/Completion/Base/Core/_description @@ -1,13 +1,13 @@ #autoload -local name gropt nopt xopt format gname hidden hide match opts tag sort +local name nopt xopt format gname hidden hide match opts tag +local -a gropt sort opts=() -gropt=(-J) xopt=(-X) nopt=() -zparseopts -K -D -a nopt 1 2 V=gropt J=gropt x=xopt +zparseopts -K -D -a nopt 1 2 V=gropt J x=xopt 3="${${3##[[:blank:]]#}%%[[:blank:]]#}" [[ -n "$3" ]] && _lastdescr=( "$_lastdescr[@]" "$3" ) @@ -33,14 +33,18 @@ zstyle -s ":completion:${curcontext}:$1" matcher match && # Use sort style, but ignore `menu' value to help _expand. # Also don't override explicit use of -V. -if { zstyle -s ":completion:${curcontext}:$1" sort sort || - zstyle -s ":completion:${curcontext}:" sort sort; } && - [[ "$gropt" = -J && $sort != menu ]]; then - if [[ "$sort" = (yes|true|1|on) ]]; then - gropt=(-J) - else - gropt=(-V) +if [[ -z "$gropt" ]]; then + if zstyle -a ":completion:${curcontext}:$1" sort sort || + zstyle -a ":completion:${curcontext}:" sort sort + then + if [[ -z "${(@)sort:#(match|numeric|reverse)}" ]]; then + gropt=( -o ${(j.,.)sort} ) + elif [[ "$sort" != (yes|true|1|on|menu) ]]; then + gropt=( -o nosort ) fi + fi +else + gropt=( -o nosort ) fi if [[ -z "$_comp_no_ignore" ]]; then @@ -79,15 +83,15 @@ fi if [[ -n "$gname" ]]; then if [[ -n "$format" ]]; then - set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname" "$xopt" "$format" + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J "$gname" "$xopt" "$format" else - set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname" + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J "$gname" fi else if [[ -n "$format" ]]; then - set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default- "$xopt" "$format" + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J -default- "$xopt" "$format" else - set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default- + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt[@]" -J -default- fi fi diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe index 76ab1d995..c12eb0eab 100644 --- a/Completion/Base/Utility/_describe +++ b/Completion/Base/Utility/_describe @@ -108,10 +108,10 @@ while _tags; do fi if [[ -n $_mats ]]; then - compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs -O $_mats - \ + compadd "$_opts[@]" -2 -o nosort "${_expl[@]}" -D $_strs -O $_mats - \ "${(@)${(@M)${(@P)_mats}##([^:\\]|\\?)##}//\\(#b)(?)/$match[1]}" else - compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \ + compadd "$_opts[@]" -2 -o nosort "${_expl[@]}" -D $_strs - \ "${(@)${(@M)${(@P)_strs}##([^:\\]|\\?)##}//\\(#b)(?)/$match[1]}" fi done diff --git a/Completion/Base/Utility/_guard b/Completion/Base/Utility/_guard index ff62981ce..1cbd4f39b 100644 --- a/Completion/Base/Utility/_guard +++ b/Completion/Base/Utility/_guard @@ -2,7 +2,7 @@ local garbage -zparseopts -K -D -a garbage M: J: V: 1 2 n F: X: +zparseopts -K -D -a garbage M+: J+: V+: 1 2 o+: n F: X+: [[ "$PREFIX$SUFFIX" != $~1 ]] && return 1 diff --git a/Completion/Base/Utility/_multi_parts b/Completion/Base/Utility/_multi_parts index 12ff965ed..00e3e26cc 100644 --- a/Completion/Base/Utility/_multi_parts +++ b/Completion/Base/Utility/_multi_parts @@ -14,8 +14,8 @@ typeset -U tmp1 matches # Get the options. zparseopts -D -a sopts \ - 'J+:=group' 'V+:=group' 'X+:=expl' 'P:=opts' 'F:=opts' \ - S: r: R: q 1 2 n f 'M+:=matcher' 'i=imm' + 'J+:=group' 'V+:=group' 'x+:=expl' 'X+:=expl' 'P:=opts' 'F:=opts' \ + S: r: R: q 1 2 o+: n f 'M+:=matcher' 'i=imm' sopts=( "$sopts[@]" "$opts[@]" ) if (( $#matcher )); then diff --git a/Completion/Base/Utility/_sep_parts b/Completion/Base/Utility/_sep_parts index de836a696..6fcf54ec4 100644 --- a/Completion/Base/Utility/_sep_parts +++ b/Completion/Base/Utility/_sep_parts @@ -22,8 +22,8 @@ local matchflags opt group expl nm=$compstate[nmatches] opre osuf opts matcher # Get the options. -zparseopts -D -a opts \ - 'J+:=group' 'V+:=group' P: F: S: r: R: q 1 2 n 'X+:=expl' 'M+:=matcher' +zparseopts -D -a opts 'J+:=group' 'V+:=group' P: F: S: r: R: q 1 2 o+: n \ + 'x+:=expl' 'X+:=expl' 'M+:=matcher' # Get the string from the line. diff --git a/Completion/Base/Utility/_sequence b/Completion/Base/Utility/_sequence index f52955f46..101934490 100644 --- a/Completion/Base/Utility/_sequence +++ b/Completion/Base/Utility/_sequence @@ -10,7 +10,8 @@ local curcontext="$curcontext" nm="$compstate[nmatches]" pre qsep nosep minus local -a sep num pref suf end uniq dedup -zparseopts -D -a opts s:=sep n:=num p:=pref i:=pref P:=pref I:=suf S:=suf q=suf r:=suf R:=suf C:=cont d=uniq M: J: X: x: +zparseopts -D -a opts s:=sep n:=num p:=pref i:=pref P:=pref I:=suf S:=suf \ + q=suf r:=suf R:=suf C:=cont d=uniq M+: J+: V+: 1 2 o+: X+: x+: (( $#cont )) && curcontext="${curcontext%:*}:$cont[2]" (( $#sep )) || sep[2]=, diff --git a/Completion/Darwin/Type/_mac_files_for_application b/Completion/Darwin/Type/_mac_files_for_application index 299d8ff5c..44516b4db 100644 --- a/Completion/Darwin/Type/_mac_files_for_application +++ b/Completion/Darwin/Type/_mac_files_for_application @@ -35,7 +35,7 @@ _mac_parse_info_plist() { # Try to complete files for the specified application. _mac_files_for_application() { local -a opts - zparseopts -D -a opts q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+: + zparseopts -D -a opts q n 1 2 o+: P: S: r: R: W: x+: X+: M+: F: J+: V+: local app_path _retrieve_mac_apps diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum index 34a337109..8abd23ebb 100644 --- a/Completion/Redhat/Command/_yum +++ b/Completion/Redhat/Command/_yum @@ -212,7 +212,7 @@ _yum_ids() { # `${(@)@[...]}' selects a subrange from $@ # `${(@)@[1,-2]}' are all except the last argument # `$@[$#]' is the last argument, e.g. the first suggestable ID - compadd "${(@)@[1,-2]:/-J/-V}" -M "B:0=" {$@[$#]..$maxid} + compadd "${(@)@[1,-2]}" -o numeric -M "B:0=" {$@[$#]..$maxid} } _yum_ranges() { diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4eb07e921..112098d3a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5688,7 +5688,7 @@ __git_ignore_line () { __git_ignore_line_inside_arguments () { declare -a compadd_opts - zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: __git_ignore_line $* $compadd_opts } @@ -6160,7 +6160,7 @@ __git_ref_fields () { local match mbegin mend local -a cfields fields append opts all - zparseopts -D -E -a opts x: X: J: V: a=all + zparseopts -D -E -a opts M+: x+: X+: J+: V+: o+: 1 2 a=all if compset -P 1 '(#b)(*):'; then case $match[1] in @@ -6731,7 +6731,7 @@ __git_tags_of_type () { tags=(${${(M)${(f)"$(_call_program ${(q)type}-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted $type-tags expl "$type tag" compadd -M 'r:|/=* r:|=*' "$@" -a - tags + _wanted $type-tags expl "$type tag" compadd -M 'r:|/=* r:|=*' "$@" -o numeric -a - tags } # Reference Argument Types @@ -6826,7 +6826,7 @@ __git_files_relative () { __git_files () { local compadd_opts opts tag description gitcdup gitprefix files expl - zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+: tag=$1 description=$2; shift 2 @@ -6957,7 +6957,7 @@ __git_tree_files () { shift fi - zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/" shift @@ -7037,7 +7037,7 @@ __git_any_repositories_or_references () { __git_guard () { declare -A opts - zparseopts -K -D -A opts M: J: V: 1 2 n F: X: + zparseopts -K -D -A opts M+: J+: V+: 1 2 o+: n F: x+: X+: [[ "$PREFIX$SUFFIX" != $~1 ]] && return 1 @@ -7075,7 +7075,7 @@ __git_guard_diff-stat-width () { __git_guard_number () { declare -A opts - zparseopts -K -D -A opts M: J: V: 1 2 n F: X: + zparseopts -K -D -A opts M+: J+: V+: 1 2 o+: n F: x+: X+: _guard '[[:digit:]]#' ${1:-number} } diff --git a/Completion/Unix/Type/_baudrates b/Completion/Unix/Type/_baudrates index add359d13..6e9ba4d97 100644 --- a/Completion/Unix/Type/_baudrates +++ b/Completion/Unix/Type/_baudrates @@ -72,7 +72,6 @@ if (( ${+opts[-f]} )); then done fi -# -1V removes dupes (which there shouldn't be) and otherwise leaves the -# order in the $rates array intact. -_description -1V baud-rates expl 'baud rate' -compadd "${(@)argv/#-J/-V}" "$expl[@]" -- "${rates[@]}" +# -1 removes dupes (which there shouldn't be) +_description -1 -o numeric baud-rates expl 'baud rate' +compadd "${argv[@]}" "$expl[@]" -- "${rates[@]}" diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths index 6eab7b677..cddc3b405 100644 --- a/Completion/Unix/Type/_canonical_paths +++ b/Completion/Unix/Type/_canonical_paths @@ -5,13 +5,14 @@ # (relative path when an absolute path is given, and vice versa; when ..'s are # present in the word to be completed, and some paths got from symlinks). -# Usage: _canonical_paths [-A var] [-N] [-MJV12nfX] tag desc [paths...] +# Usage: _canonical_paths [-A var] [-N] [-MJV12onfX] tag desc [paths...] # -A, if specified, takes the paths from the array variable specified. Paths # can also be specified on the command line as shown above. -N, if specified, # prevents canonicalizing the paths given before using them for completion, in # case they are already so. `tag' and `desc' arguments are well, obvious :) In -# addition, the options -M, -J, -V, -1, -2, -n, -F, -X are passed to compadd. +# addition, the options -M, -J, -V, -1, -2, -o, -n, -F, -x, -X are passed to +# compadd. _canonical_paths_add_paths () { # origpref = original prefix @@ -59,7 +60,7 @@ _canonical_paths() { local __index typeset -a __gopts __opts - zparseopts -D -a __gopts M: J: V: 1 2 n F: X: A:=__opts N=__opts + zparseopts -D -a __gopts M+: J+: V+: o+: 1 2 n F: x+: X+: A:=__opts N=__opts : ${1:=canonical-paths} ${2:=path} diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index 467ed747c..6adaa8154 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -27,7 +27,7 @@ local opts tmp glob pat pats expl tag i def descr end ign tried local type sdef ignvars ignvar prepath oprefix rfiles rfile zparseopts -a opts \ - '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+: + '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: x+: X+: M+: F: J+: V+: o+: type="${(@j::M)${(@)tmp#-}#?}" if (( $tmp[(I)-g*] )); then diff --git a/Completion/Unix/Type/_list_files b/Completion/Unix/Type/_list_files index 6c52bc1f4..0ea02a55a 100644 --- a/Completion/Unix/Type/_list_files +++ b/Completion/Unix/Type/_list_files @@ -64,6 +64,6 @@ for f in ${(PQ)1}; do ${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f") done -(( ${#listfiles} )) && listopts=(-d listfiles -l -o) +(( ${#listfiles} )) && listopts=(-d listfiles -l -o match) return 0 diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index 1021c34e6..19ae59629 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -59,7 +59,7 @@ exppaths=() zparseopts -a mopts \ 'P:=pfx' 'S:=pfxsfx' 'q=pfxsfx' 'r:=pfxsfx' 'R:=pfxsfx' \ 'W:=prepaths' 'F:=ignore' 'M+:=matcher' \ - J+: V+: X+: 1 2 n 'f=tmp1' '/=tmp1' 'g+:-=tmp1' + J+: V+: x+: X+: 1 2 o+: n 'f=tmp1' '/=tmp1' 'g+:-=tmp1' sopt="-${(@j::M)${(@)tmp1#-}#?}" (( $tmp1[(I)-[/g]*] )) && haspats=yes @@ -168,7 +168,7 @@ if zstyle -s ":completion:${curcontext}:" file-sort tmp1; then if [[ "$sort" = on ]]; then sort= else - mopts=( "${(@)mopts/#-J/-V}" ) + mopts=( -o nosort "${mopts[@]}" ) tmp2=() for tmp1 in "$pats[@]"; do diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd index e709e400e..781fa2af8 100644 --- a/Completion/Zsh/Command/_compadd +++ b/Completion/Zsh/Command/_compadd @@ -14,9 +14,13 @@ _arguments -C -s -S -A "-*" \ '(-a)-k[matches are keys of specified associative arrays]' \ '-d+[specify display strings]:array:_parameters -g "*array*"' \ '-l[list display strings one per line, not in columns]' \ - '-o[order matches by match string not by display string]' \ - '(-1 -E)-J+[specify match group which will be sorted]:group' \ - '-V+[specify pre-ordered match group]:group' \ + '-o[specify order for matches by match string not by display string]:: : _values -s , order + "match[order by match not by display string]" + "nosort[matches are pre-ordered]" + "numeric[order numerically]" + "reverse[order backwards]"' \ + '(-1 -E)-J+[specify match group]:group' \ + '!-V+:group' \ '(-J -E)-1[remove only consecutive duplicates from group]' \ '-2[preserve all duplicates]' \ '(-x)-X[specify explanation]:explanation' \ @@ -45,7 +49,7 @@ if [[ -n $state ]]; then elif (( $+opt_args[-k] )); then _parameters -g "*assoc*" && ret=0 else - _message -e candidate candidates + _message -e candidates candidate fi fi diff --git a/Completion/Zsh/Type/_file_descriptors b/Completion/Zsh/Type/_file_descriptors index 3e9f4968b..be96dd0e4 100644 --- a/Completion/Zsh/Type/_file_descriptors +++ b/Completion/Zsh/Type/_file_descriptors @@ -56,4 +56,4 @@ fi fds=( 0 1 2 $fds ) _description -V file-descriptors expl 'file descriptor' -compadd $disp "${@/-J/-V}" "$expl[@]" -a fds +compadd $disp -o nosort "$@" "$expl[@]" -a fds |