From ac88d2bbefb45549c4960f7c4e4d58b98a0819ab Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 27 Mar 2002 16:10:07 +0000 Subject: [PATCH] 16913: fix completion after compdef -a and correct typos --- ChangeLog | 3 +++ Completion/Zsh/Command/_compdef | 9 +++++---- Doc/Zsh/compsys.yo | 25 ++++++++++++------------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 384cdaa12..f877364e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2002-03-27 Oliver Kiddle + * 16913: Completion/Zsh/Command/_compdef, Doc/Zsh/compsys.yo: + fix completion after compdef -a and correct typos + * John Beppu: 16866 (tweaked): Completion/Unix/Command/_figlet: new completion for figlet diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef index 48daa9e53..469b135c4 100644 --- a/Completion/Zsh/Command/_compdef +++ b/Completion/Zsh/Command/_compdef @@ -13,7 +13,7 @@ if (( ! ${words[2,-1][(I)[^-]*]} || ${words[(I)-[kK]]} )); then ) args2=( - d - '(-a -n)-d[delete]:*:completed command:->ccom' + '-d[delete]:*:completed command:->ccom' - k '-k[define widget and key binding]:completion function:->cfun:style:->style:*:key' - K @@ -21,14 +21,15 @@ if (( ! ${words[2,-1][(I)[^-]*]} || ${words[(I)-[kK]]} )); then ) else args1=( - '-N[completion for named command]' + '!-a' '!-n' + '*-N[completion for named command]' ) fi _arguments -C -s -S \ "$args1[@]" \ - '-p[completion for command matching pattern]' \ - '-P[completion for command matching pattern]' \ + '*-p[completion for command matching pattern]' \ + '*-P[completion for command matching pattern]' \ ':completion function:->cfun' \ '*:commands:->com' \ "$args2[@]" && return 0 diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index c273fd917..8651c67d8 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -272,25 +272,24 @@ with the tt(#compdef) tag and an argument of the form `var(cmd)tt(=)var(service)'. This kind of use makes the arguments of the var(cmd)s be completed as those for the var(services). -In the first case and the following cases the var(function) may actually -be a string containing any shell code and that string will be executed -via the tt(eval) builtin command. This allows to easily define completions -for commands that need to call one of the completion functions with -arguments. For example to make files ending in `tt(.h)' be completed as -arguments to the command tt(foo), one would use: +The var(function) may actually be a string containing any shell code +and that string will be executed via the tt(eval) builtin command. +This allows to easily define completions for commands that need to call +one of the completion functions with arguments. For example to make +files ending in `tt(.h)' be completed as arguments to the command +tt(foo), one would use: example(compdef '_files -g "*.h"' foo) -If the -tt(-n) option is given, any existing completion behaviour for particular -contexts or commands will not be altered. These definitions can be deleted -by giving the tt(-d) option as in the second form. +If the tt(-n) option is given, any existing completion behaviour for +particular contexts or commands will not be altered. These definitions +can be deleted by giving the tt(-d) option as in the second form. -In both of the first two cases forms and as for the tt(#compdef) tag +In both of the first two forms and as for the tt(#compdef) tag described above, the var(names) may also contain tt(-p), tt(-P) and tt(-N) options. The first two make the following arguments be used as patterns and the var(function) will be called for all commands and -contexts matching one of the patterns. Wtih tt(-P) this will only +contexts matching one of the patterns. With tt(-P) this will only happen if no specific function is defined for the command or context. The tt(-N) option toggles back to using the var(names) as described above. @@ -335,7 +334,7 @@ do: example(compdef _pids foo) using the tt(_pids) function from the distribution to generate the -process identifiers. Not also the tt(_gnu_generic) function described +process identifiers. Note also the tt(_gnu_generic) function described below, which can be used to complete options for commands that understand the `tt(-)tt(-help)' option.