Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments



2009-11-12 21:13:39 +0100, Ingmar Vanhassel:
> ---
>  Completion/Unix/Command/_env |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> I was getting a few patch series ready to send, but I guess I can fire this one
> off already, it probably fixes your issue.
> 
> What I've not figured out, is how to make 'env FOO=bar quux <TAB>' complete
> options to 'quux'. I guess that'll take someone with more experience than me.
> 
> diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env
> index 2638186..383891f 100644
> --- a/Completion/Unix/Command/_env
> +++ b/Completion/Unix/Command/_env
> @@ -3,7 +3,7 @@
>  if _pick_variant gnu=Free\ Soft unix --version; then
>    _arguments \
>      '(--ignore-environment -i)'{-i,--ignore-environment}'[start with empty environment]' \
> -    {-u,--unset=}':env var to remove:compadd ${(k)parameters[(R)*export*]}' \
> +    '(--unset= -u)'{-u,--unset=}'[remove variable from the environment]:env var to remove:compadd ${(k)parameters[(R)*export*]}' \

That doesn't solve the OP's initial problem (that the -u option
wasn't offered anymore after it has been provided once). You'd
need:

'*'{-u,--unset=}...

instead (as someone already pointed out).

>      '--help[help]' \
>      '--version[version]' \
>      '*::arguments: _normal'

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author