diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Core/_all_labels | 12 | ||||
-rw-r--r-- | Completion/Base/Core/_description | 18 | ||||
-rw-r--r-- | Completion/Base/Core/_message | 7 | ||||
-rw-r--r-- | Completion/Base/Core/_next_label | 12 | ||||
-rw-r--r-- | Completion/Base/Core/_requested | 12 | ||||
-rw-r--r-- | Completion/Base/Core/_wanted | 21 |
6 files changed, 34 insertions, 48 deletions
diff --git a/Completion/Base/Core/_all_labels b/Completion/Base/Core/_all_labels index 8665f5bf3..9dda58131 100644 --- a/Completion/Base/Core/_all_labels +++ b/Completion/Base/Core/_all_labels @@ -1,16 +1,14 @@ #autoload -local __gopt=-J __len __tmp __pre __suf __ret=1 __descr __spec __prev +local __gopt __len __tmp __pre __suf __ret=1 __descr __spec __prev if [[ "$1" = - ]]; then __prev=- shift fi -if [[ "$1" = -([12]|)[VJ] ]]; then - __gopt="$1" - shift -fi +__gopt=() +zparseopts -D -a __gopt 1 2 V J x __tmp=${argv[(ib:4:)-]} __len=$# @@ -29,12 +27,12 @@ while comptags "-A$__prev" "$1" curtag __spec; do _comp_tags="$_comp_tags $__spec " if [[ "$curtag" = *[^\\]:* ]]; then zformat -f __descr "${curtag#*:}" "d:$3" - _description "$__gopt" "${curtag%:*}" "$2" "$__descr" + _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr" curtag="${curtag%:*}" "$4" "${(P@)2}" "${(@)argv[5,-1]}" && __ret=0 else - _description "$__gopt" "$curtag" "$2" "$3" + _description "$__gopt[@]" "$curtag" "$2" "$3" "${(@)argv[4,__pre]}" "${(P@)2}" "${(@)argv[__suf,-1]}" && __ret=0 fi diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description index 30e6dfa9b..41f4f2483 100644 --- a/Completion/Base/Core/_description +++ b/Completion/Base/Core/_description @@ -1,13 +1,13 @@ #autoload -local name gropt=-J format gname hidden hide match opts tag +local name gropt nopt xopt format gname hidden hide match opts tag opts=() -if [[ "$1" = -([12]|)[VJ] ]]; then - gropt="$1" - shift -fi +gropt=(-J) +xopt=(-X) +nopt=() +zparseopts -K -D -a nopt 1 2 V=gropt J=gropt x=xopt 3="${${3##[[:blank:]]#}%%[[:blank:]]#}" [[ -n "$3" ]] && _lastdescr=( "$_lastdescr[@]" "$3" ) @@ -62,15 +62,15 @@ fi if [[ -n "$gname" ]]; then if [[ -n "$format" ]]; then - set -A "$name" "$opts[@]" "$gropt" "$gname" -X "$format" + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname" "$xopt" "$format" else - set -A "$name" "$opts[@]" "$gropt" "$gname" + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname" fi else if [[ -n "$format" ]]; then - set -A "$name" "$opts[@]" "$gropt" -default- -X "$format" + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default- "$xopt" "$format" else - set -A "$name" "$opts[@]" "$gropt" -default- + set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default- fi fi diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message index 44512f648..979dfa097 100644 --- a/Completion/Base/Core/_message +++ b/Completion/Base/Core/_message @@ -1,6 +1,6 @@ #autoload -local format raw +local format raw gopt if [[ "$1" = -e ]]; then local expl ret=1 @@ -15,6 +15,9 @@ if [[ "$1" = -e ]]; then return ret fi +gopt=() +zparseopts -D -a gopt 1 2 V J + _tags messages || return 1 if [[ "$1" = -r ]]; then @@ -28,6 +31,6 @@ fi if [[ -n "$format$raw" ]]; then [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}" - builtin compadd -x "$format" + builtin compadd "$gopt[@]" -x "$format" _comp_mesg=yes fi diff --git a/Completion/Base/Core/_next_label b/Completion/Base/Core/_next_label index 48845229a..ff9b658a1 100644 --- a/Completion/Base/Core/_next_label +++ b/Completion/Base/Core/_next_label @@ -1,21 +1,19 @@ #autoload -local __gopt=-J __descr __spec +local __gopt __descr __spec -if [[ "$1" = -([12]|)[VJ] ]]; then - __gopt="$1" - shift -fi +__gopt=() +zparseopts -D -a __gopt 1 2 V J x if comptags -A "$1" curtag __spec; then _comp_tags="$_comp_tags $__spec " if [[ "$curtag" = *[^\\]:* ]]; then zformat -f __descr "${curtag#*:}" "d:$3" - _description "$__gopt" "${curtag%:*}" "$2" "$__descr" + _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr" curtag="${curtag%:*}" set -A $2 "${(P@)2}" "${(@)argv[4,-1]}" else - _description "$__gopt" "$curtag" "$2" "$3" + _description "$__gopt[@]" "$curtag" "$2" "$3" set -A $2 "${(@)argv[4,-1]}" "${(P@)2}" fi diff --git a/Completion/Base/Core/_requested b/Completion/Base/Core/_requested index 5614098bc..4ba52ce7f 100644 --- a/Completion/Base/Core/_requested +++ b/Completion/Base/Core/_requested @@ -1,17 +1,15 @@ #autoload -local __gopt=-J +local __gopt -if [[ "$1" = -([12]|)[VJ] ]]; then - __gopt="$1" - shift -fi +__gopt=() +zparseopts -D -a __gopt 1 2 V J x if comptags -R "$1"; then if [[ $# -gt 3 ]]; then - _all_labels - "$__gopt" "$@" || return 1 + _all_labels - "$__gopt[@]" "$@" || return 1 elif [[ $# -gt 1 ]]; then - _description "$__gopt" "$@" + _description "$__gopt[@]" "$@" fi return 0 else diff --git a/Completion/Base/Core/_wanted b/Completion/Base/Core/_wanted index 3e25fdbbc..f96b266bd 100644 --- a/Completion/Base/Core/_wanted +++ b/Completion/Base/Core/_wanted @@ -1,26 +1,15 @@ #autoload -local __targs __gopt=-J +local __targs __gopt -if [[ "$1" = -C?* ]]; then - __targs=( -C "${1[3,-1]}" ) - shift -elif [[ "$1" = -C ]]; then - __targs=( -C "$2" ) - shift 2 -else - __targs=() -fi - -if [[ "$1" = -([12]|)[VJ] ]]; then - __gopt="$1" - shift -fi +__gopt=() +__tagrs=() +zparseopts -D -a __gopt 1 2 V J x C:=__targs _tags "$__targs[@]" "$1" while _tags; do - _all_labels "$__gopt" "$@" && return 0 + _all_labels "$__gopt[@]" "$@" && return 0 done return 1 |