zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments
       [not found] <alpine.LNX.2.01.0911121446150.26715@hp.internal>
@ 2009-11-12 20:13 ` Ingmar Vanhassel
  2009-11-12 20:52   ` Benjamin R. Haskell
  2009-11-13 13:47   ` Stephane Chazelas
  0 siblings, 2 replies; 5+ messages in thread
From: Ingmar Vanhassel @ 2009-11-12 20:13 UTC (permalink / raw)
  To: Zsh hackers list; +Cc: Zsh users list, 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*]}' \
     '--help[help]' \
     '--version[version]' \
     '*::arguments: _normal'
-- 
1.6.5.2.351.g0943


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments
  2009-11-12 20:13 ` [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments Ingmar Vanhassel
@ 2009-11-12 20:52   ` Benjamin R. Haskell
  2009-11-12 21:16     ` Ingmar Vanhassel
  2009-11-13 13:47   ` Stephane Chazelas
  1 sibling, 1 reply; 5+ messages in thread
From: Benjamin R. Haskell @ 2009-11-12 20:52 UTC (permalink / raw)
  To: Zsh Workers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 792 bytes --]

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

[-- Attachment #2: Type: TEXT/PLAIN, Size: 866 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments
  2009-11-12 20:52   ` Benjamin R. Haskell
@ 2009-11-12 21:16     ` Ingmar Vanhassel
  2009-11-12 21:46       ` Benjamin R. Haskell
  0 siblings, 1 reply; 5+ messages in thread
From: Ingmar Vanhassel @ 2009-11-12 21:16 UTC (permalink / raw)
  To: zsh-workers

Excerpts from Benjamin R. Haskell's message of Thu Nov 12 21:52:50 +0100 2009:
> 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:

Thanks :)

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

This doesn't fix 'env FOO=bar quux <TAB>' here.

> 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
-- 
Exherbo KDE, X.org maintainer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments
  2009-11-12 21:16     ` Ingmar Vanhassel
@ 2009-11-12 21:46       ` Benjamin R. Haskell
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin R. Haskell @ 2009-11-12 21:46 UTC (permalink / raw)
  To: Zsh Workers

On Thu, 12 Nov 2009, Ingmar Vanhassel wrote:

> Excerpts from Benjamin R. Haskell's message of Thu Nov 12 21:52:50 +0100 2009:
> > On Thu, 12 Nov 2009, Ingmar Vanhassel wrote:
> >
> > [...]
> > 3. the fix to complete arguments to the command passed to 'env'
> 
> This doesn't fix 'env FOO=bar quux <TAB>' here.

I agree. :-) Spoke too soon.  (I'd only tested with 'env -u BLAH quux <TAB>')

I thought the '(-):command: _command_names -e' line was more magical than 
it is.  Turns out the '*::arguments: _normal' is the 'quux <TAB>'-enabling 
portion, modulo the intervening FOO=bar args.

This way lie dragons.  Going back to ye cave of Zsh-completion 
begginneres.

-- Ben


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments
  2009-11-12 20:13 ` [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments Ingmar Vanhassel
  2009-11-12 20:52   ` Benjamin R. Haskell
@ 2009-11-13 13:47   ` Stephane Chazelas
  1 sibling, 0 replies; 5+ messages in thread
From: Stephane Chazelas @ 2009-11-13 13:47 UTC (permalink / raw)
  To: Ingmar Vanhassel; +Cc: Zsh hackers list, Zsh users list

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-13 13:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <alpine.LNX.2.01.0911121446150.26715@hp.internal>
2009-11-12 20:13 ` [PATCH] env completion: add missing explanation of --unset option, fixes alignment of completed arguments Ingmar Vanhassel
2009-11-12 20:52   ` Benjamin R. Haskell
2009-11-12 21:16     ` Ingmar Vanhassel
2009-11-12 21:46       ` Benjamin R. Haskell
2009-11-13 13:47   ` Stephane Chazelas

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).