diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-03 13:47:39 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-03 13:47:39 +0000 |
commit | 97f02ffe63909c84cb9771d20a73ebec55f49589 (patch) | |
tree | 997db6027bc486992bdab800ed53404512446919 /Completion/Base/_describe | |
parent | 3eeb83f1a0a01a16f137cef2dfc2c9d8c1626875 (diff) | |
download | zsh-97f02ffe63909c84cb9771d20a73ebec55f49589.tar.gz zsh-97f02ffe63909c84cb9771d20a73ebec55f49589.tar.xz zsh-97f02ffe63909c84cb9771d20a73ebec55f49589.zip |
zsh-workers/8520
Diffstat (limited to 'Completion/Base/_describe')
-rw-r--r-- | Completion/Base/_describe | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/Completion/Base/_describe b/Completion/Base/_describe index e59dc1593..5355e4d7f 100644 --- a/Completion/Base/_describe +++ b/Completion/Base/_describe @@ -2,15 +2,19 @@ # This can be used to add options or values with descriptions as matches. -local isopt cmd opt expl tmps tmpd tmpmd tmpms ret=1 showd _nm hide +local cmd func opt expl tmps tmpd tmpmd tmpms ret=1 showd _nm hide +local prios tags type=value cmd="$words[1]" +func="$funcstack[2]" # Get the options. -while getopts 'oc:' opt; do +while getopts 'oc:f:' opt; do if [[ "$opt" = o ]]; then - isopt=yes + type=option + elif [[ "$opt" = f ]]; then + func="$OPTARG" else cmd="$OPTARG" fi @@ -19,28 +23,11 @@ shift OPTIND-1 # Do the tests. `showd' is set if the descriptions should be shown. -if [[ -n "$isopt" ]]; then +_tags -c "$cmd" -f "$func" "$type" - # We take the value to test the number of matches from a non-local - # parameter `nm' if that exists and contains only digits. It's a hack. +_tags || return 1 - if [[ "$nm" = [0-9]## ]]; then - _nm="$nm" - else - _nm=0 - fi - [[ -n "$compconfig[option_prefix]" && - "$compconfig[option_prefix]" != *\!${cmd}* && - "$PREFIX" != [-+]* && - ( "$compconfig[option_prefix]" = *nodefault* || - _nm -ne compstate[nmatches] ) ]] && return 1 - - [[ -n "$compconfig[describe_options]" && - "$compconfig[describe_options]" != *\!${cmd}* ]] && showd=yes -else - [[ -n "$compconfig[describe_values]" && - "$compconfig[describe_values]" != *\!${cmd}* ]] && showd=yes -fi +[[ "$tags" = *:${type}\[*describe*\]* ]] && showd=yes _description expl "$1" shift @@ -51,7 +38,7 @@ else compdescribe -i "$@" fi -[[ -n "$isopt" && "$compconfig[option_prefix]" = hide* ]] && hide=yes +[[ "$type" = option && "$tags" = *:option\[*hide*\]* ]] && hide=yes while compdescribe -g args tmpd tmpmd tmps tmpms; do |