diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-09 13:14:59 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-09 13:14:59 +0000 |
commit | c615397157e5efd7a81c8ce11b3f77fd7ccb5a19 (patch) | |
tree | 9f6e9081024370574ae18b5808ebedf6d653d672 /Completion/Base | |
parent | 95af0ef9c4639763c8094d6e8cd5d8ec01a32f96 (diff) | |
download | zsh-c615397157e5efd7a81c8ce11b3f77fd7ccb5a19.tar.gz zsh-c615397157e5efd7a81c8ce11b3f77fd7ccb5a19.tar.xz zsh-c615397157e5efd7a81c8ce11b3f77fd7ccb5a19.zip |
zsh-workers/8603
Diffstat (limited to 'Completion/Base')
-rw-r--r-- | Completion/Base/_arguments | 26 | ||||
-rw-r--r-- | Completion/Base/_describe | 15 | ||||
-rw-r--r-- | Completion/Base/_values | 10 |
3 files changed, 24 insertions, 27 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index 31713750f..68b52eef4 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -154,14 +154,14 @@ fi if comparguments -i "$compconfig[autodescribe_options]" "$@"; then local nm="$compstate[nmatches]" action noargs aret expl local local next direct odirect equal single match matched ws tmp1 tmp2 - local tags opts + local opts if comparguments -D descr action; then if comparguments -O next direct odirect equal; then opts=yes - _tags -f "$funcstack[2]" argument option + _tags argument option else - _tags -f "$funcstack[2]" argument + _tags argument fi else if comparguments -a; then @@ -172,12 +172,12 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then comparguments -O next direct odirect equal || return 1 opts=yes - _tags -f "$funcstack[2]" option + _tags option fi while _tags; do while true; do - if [[ "$tags" = *:argument* ]]; then + if [[ -n "$matched" ]] || _requested argument; then _description expl "$descr" if [[ "$action" = -\>* ]]; then @@ -207,7 +207,7 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then eval ws\=\( "${action[3,-3]}" \) - _describe -c "$cmd" -f "$funcstack[2]" "$descr" ws -M "$match" + _describe -c "$cmd" "$descr" ws -M "$match" elif [[ "$action" = \(*\) ]]; then @@ -234,8 +234,8 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then fi fi fi - if [[ "$tags" = *:option* && - ( "$tags" != *\[*prefix*\]* || "$PREFIX" = [-+]* ) ]]; then + if [[ -z "$matched" ]] && _requested option && + { ! _style option prefix || [[ "$PREFIX" = [-+]* ]] } ; then comparguments -M match if comparguments -s single; then @@ -253,20 +253,21 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" ) tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" ) - _describe -o -c "$cmd" -f "$funcstack[2]" option \ + _describe -o -c "$cmd" option \ tmp1 tmp2 -Q -S '' fi single=yes else next=( "$next[@]" "$odirect[@]" ) - _describe -o -c "$cmd" -f "$funcstack[2]" option \ + _describe -o -c "$cmd" option \ next -Q -M "$match" -- \ direct -QS '' -M "$match" -- \ equal -QqS= -M "$match" fi fi - if [[ -n "$opts" && -z "$aret$matched" && nm -ne compstate[nmatches] && - "$tags" = *:argument* ]]; then + if [[ -n "$opts" && -z "$aret$matched" && + nm -ne compstate[nmatches] ]] && + _requested argument; then local prefix suffix @@ -282,7 +283,6 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then IPREFIX="${IPREFIX}${equal[1]%%:*}=" matched=yes comparguments -L "$equal[1]" descr action - tags=argument continue fi fi diff --git a/Completion/Base/_describe b/Completion/Base/_describe index ddd35f0e7..41c2ba8e5 100644 --- a/Completion/Base/_describe +++ b/Completion/Base/_describe @@ -2,19 +2,16 @@ # This can be used to add options or values with descriptions as matches. -local cmd func opt expl tmps tmpd tmpmd tmpms ret=1 showd _nm hide -local tags type=value +local cmd opt expl tmps tmpd tmpmd tmpms ret=1 showd _nm hide +local type=value cmd="$words[1]" -func="$funcstack[2]" # Get the options. -while getopts 'oc:f:' opt; do +while getopts 'oc:' opt; do if [[ "$opt" = o ]]; then type=option - elif [[ "$opt" = f ]]; then - func="$OPTARG" else cmd="$OPTARG" fi @@ -23,9 +20,9 @@ shift OPTIND-1 # Do the tests. `showd' is set if the descriptions should be shown. -_tags -i -c "$cmd" -f "$func" "$type" || return 1 +_tags -c "$cmd" "$type" || return 1 -[[ "$tags" = *:${type}\[*describe*\]* ]] && showd=yes +_style "$type" describe && showd=yes _description expl "$1" shift @@ -36,7 +33,7 @@ else compdescribe -i "$@" fi -[[ "$type" = option && "$tags" = *:option\[*hide*\]* ]] && hide=yes +[[ "$type" = option ]] && _style option hide && hide=yes while compdescribe -g args tmpd tmpmd tmps tmpms; do diff --git a/Completion/Base/_values b/Completion/Base/_values index 9d89c7ea9..aac8b392d 100644 --- a/Completion/Base/_values +++ b/Completion/Base/_values @@ -2,11 +2,11 @@ if compvalues -i "$@"; then - local tags noargs args opts descr action expl sep + local noargs args opts descr action expl sep if ! compvalues -D descr action; then - _tags -i value || return 1 + _tags value || return 1 compvalues -V noargs args opts @@ -42,7 +42,7 @@ if compvalues -i "$@"; then sep=() fi - _describe -f "$funcstack[2]" "$descr" \ + _describe "$descr" \ noargs "$sep[@]" -M 'r:|[_-]=* r:|=*' -- \ args -S= -M 'r:|[_-]=* r:|=*' -- \ opts -qS= -M 'r:|[_-]=* r:|=*' @@ -51,7 +51,7 @@ if compvalues -i "$@"; then fi fi - _tags -i argument || return 1 + _tags argument || return 1 _description expl "$descr" @@ -85,7 +85,7 @@ if compvalues -i "$@"; then eval ws\=\( "${action[3,-3]}" \) - _describe -f "$funcstack[2]" "$descr" ws -M 'r:|[_-]=* r:|=*' + _describe "$descr" ws -M 'r:|[_-]=* r:|=*' elif [[ "$action" = \(*\) ]]; then |