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



On Thu, 12 Nov 2009, Ingmar Vanhassel wrote:

> ---
>  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.

Took a hint from _xargs...  Attached patch incorporates:

1. my fix to allow multiple '-u/--unset=' args
2. Ingmar's documentation fix
3. the fix to complete arguments to the command passed to 'env'

Does not include the '(--unset= -u)' Ingmar had prepended to the '-u' 
line.  (I think that would explicitly prevent multiple -u/--unset args.)

Best,
Ben
Index: Completion/Unix/Command/_env
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_env,v
retrieving revision 1.1
diff -u -r1.1 _env
--- Completion/Unix/Command/_env	13 Apr 2006 02:46:50 -0000	1.1
+++ Completion/Unix/Command/_env	12 Nov 2009 20:47:25 -0000
@@ -3,9 +3,10 @@
 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*]}' \
+    '*'{-u,--unset=}'[remove variable from the environment]:env var to remove:compadd ${(k)parameters[(R)*export*]}' \
     '--help[help]' \
     '--version[version]' \
+    '(-):command: _command_names -e' \
     '*::arguments: _normal'
 else
   _precommand


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