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

Re: Bug#375959: zsh: env completion is broken



On Thu, Jun 29, 2006 at 10:44:28AM +0200, Vincent Bernat wrote:
> env completion does not work correctly.
> 
> env <TAB> is correct but env VAR1=value1 VAR2=value2 <TAB> only
> searches for files while it should search for external commands.

I don't think this is quite right.

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	13 Dec 2007 18:06:40 -0000
@@ -1,12 +1,22 @@
 #compdef env
 
+local context state line
+typeset -A opt_args
+
 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*]}' \
     '--help[help]' \
     '--version[version]' \
-    '*::arguments: _normal'
+    '*::arguments:->args' && return 0
+
+    case "$state" in
+	(args)
+	compset -n $(( words[(i)[^=]##] - 1 ))
+	_normal
+	;;
+    esac
 else
   _precommand
 fi



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