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

Problem with 'env' completion (was: Using another command's completion function with an alias)



On Thu, 12 Nov 2009, Benjamin R. Haskell wrote:

> [...]
>
> alias noagent='env -u SSH_AGENT_PID -u SSH_AUTH_SOCK'
> 
> But, compdef noagent=-command-  doesn't have the desired effect.  I 
> instead get the completion for 'env':
> 
> $ noagent <C-x><h>
> tags in context :completion::complete:-u::
>     all-files  (_files _default (eval))
> tags in context :completion::complete:env::
>     argument-rest  (_arguments _env (eval))

Upon further tinkering, I think this might (additionally) be a problem 
with the completion for 'env'...

It doesn't seem to like more than one '-u' argument:

$ env -u <C-x><h>
tags in context :completion::complete:env::
    option-u-1  (_arguments _env (eval))

$ env -u SSH_AUTH_SOCK -u <C-x><h>
tags in context :completion::complete:-u::
    all-files  (_files _default (eval))
tags in context :completion::complete:env::
    argument-rest  (_arguments _env (eval))

But (as an example showing that multiple '-u' args are fine):

$ export A=1 B=2
$ env | grep '^[A-Z]='
A=1
B=2
$ env -u A | grep '^[A-Z]='
B=2
$ env -u A -u B | grep '^[A-Z]='
$

Best,
Ben



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