Patchwork zsh_completion: hide commands' stderr when parsing their output

login
register
mail settings
Submitter Nikolaj Sjujskij
Date April 17, 2013, 7:49 a.m.
Message ID <op.wvoddhrzh7emz2@verkdatorn.npdb>
Download mbox | patch
Permalink /patch/1377/
State Rejected, archived
Headers show

Comments

Nikolaj Sjujskij - April 17, 2013, 7:49 a.m.
Den 2013-04-17 10:50:05 skrev Brendan Cully <brendan@kublai.com>:

> On Wednesday, 17 April 2013 at 10:41, Nikolaj Sjujskij wrote:
>> # HG changeset patch
>> # User Nikolaj Sjujskij <sterkrig@myopera.com>
>> # Date 1365878437 -14400
>> #      Sat Apr 13 22:40:37 2013 +0400
>> # Node ID e86de327d1a634f454556a34170826b1cad58f11
>> # Parent  12acbea17625a1441503418f7f2f49aa3825cf2f
>> zsh_completion: hide commands' stderr when parsing their output
>>
>> If anything is wrong with hg command used, its stderr output should be  
>> silenced
>> rather than mangle command line.
>>
>> Change merged back from zsh.git repo, which diverged a bit since when  
>> in 2009
>> Brendan Cully got this file (as it was in 7f349588665f) included there.  
>> Command
>> invocations added to our `zsh_completion` since 2009 updated as well.
>
> Thanks. I'm a little confused though, since _hg_cmd is defined thusly:
>
> _hg_cmd() {
>   _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
> }
>
> Shouldn't that already be suppressing stderr?

Hah, true. And it seems to be suppressing stderr indeed (tried with `hg  
qgoto` which uses _hg_qseries out of repo).
I kinda trusted zsh guys, to be honest :)
Thanks for quick review.

  Matt and crew, please ignore this patch.


Brendan, while we're at it. Another questionable change made in zsh.git:

    '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
    '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
    '--amend[amend the parent of the working dir]' \

Apart from difference in descriptions (which I intend to keep closer to  
help entries), there's two things:
  * should we really complete --logfile with .txt-files only? Doesn't sound  
like a big deal, but...
  * does dropping last colon in ":text:" make any actual difference? As far  
as I can deduce from `man zshcompsys`, both variants define empty  
completing action, but ":text:" does this more explicitly (for my taste).

Do we need anything here? I'd say no, except maybe for "*.txt".
Brendan Cully - April 17, 2013, 4:36 p.m.
On Wednesday, 17 April 2013 at 11:49, Nikolaj Sjujskij wrote:
> Brendan, while we're at it. Another questionable change made in zsh.git:
> 
> diff --git a/contrib/zsh_completion b/contrib/zsh_completion
> --- a/contrib/zsh_completion
> +++ b/contrib/zsh_completion
> @@ -564,8 +564,8 @@
>  _hg_cmd_commit() {
>    _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
>    '(--addremove -A)'{-A,--addremove}'[mark new/missing files as
> added/removed before committing]' \
> -  '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
> -  '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log
> file:_files -g \*.txt' \
> +  '(--message -m)'{-m+,--message}'[specify commit message]:text' \
> +  '(--logfile -l)'{-l+,--logfile}'[read commit message from specified
> file]:log file:_files' \
>    '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
>    '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
>    '--amend[amend the parent of the working dir]' \
> 
> Apart from difference in descriptions (which I intend to keep closer to help
> entries), there's two things:
>  * should we really complete --logfile with .txt-files only? Doesn't sound
> like a big deal, but...

I'm -1 on this.

>  * does dropping last colon in ":text:" make any actual difference? As far
> as I can deduce from `man zshcompsys`, both variants define empty completing
> action, but ":text:" does this more explicitly (for my taste).

Here, I can't remember the details of zsh completion well enough any
more. I'd say leave it alone if we can't show that it breaks something.

> Do we need anything here? I'd say no, except maybe for "*.txt".
>
Nikolaj Sjujskij - April 17, 2013, 4:40 p.m.
Den 2013-04-17 20:36:55 skrev Brendan Cully <brendan@kublai.com>:

> On Wednesday, 17 April 2013 at 11:49, Nikolaj Sjujskij wrote:
>> Brendan, while we're at it. Another questionable change made in zsh.git:
>>
>> diff --git a/contrib/zsh_completion b/contrib/zsh_completion
>> --- a/contrib/zsh_completion
>> +++ b/contrib/zsh_completion
>> @@ -564,8 +564,8 @@
>>  _hg_cmd_commit() {
>>    _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts  
>> \
>>    '(--addremove -A)'{-A,--addremove}'[mark new/missing files as
>> added/removed before committing]' \
>> -  '(--message -m)'{-m+,--message}'[use <text> as commit  
>> message]:text:' \
>> -  '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log
>> file:_files -g \*.txt' \
>> +  '(--message -m)'{-m+,--message}'[specify commit message]:text' \
>> +  '(--logfile -l)'{-l+,--logfile}'[read commit message from specified
>> file]:log file:_files' \
>>    '(--date -d)'{-d+,--date}'[record datecode as commit date]:date  
>> code:' \
>>    '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
>>    '--amend[amend the parent of the working dir]' \
>>
>> Apart from difference in descriptions (which I intend to keep closer to  
>> help
>> entries), there's two things:
>>  * should we really complete --logfile with .txt-files only? Doesn't  
>> sound like a big deal, but...
>
> I'm -1 on this.
  -1 on completing only *.txt files (current situation) or changing it to  
complete all files?

>>  * does dropping last colon in ":text:" make any actual difference? As  
>> far
>> as I can deduce from `man zshcompsys`, both variants define empty  
>> completing
>> action, but ":text:" does this more explicitly (for my taste).
>
> Here, I can't remember the details of zsh completion well enough any
> more. I'd say leave it alone if we can't show that it breaks something.
  Understood; I agree.
Brendan Cully - April 17, 2013, 4:42 p.m.
On Wednesday, 17 April 2013 at 20:40, Nikolaj Sjujskij wrote:
> Den 2013-04-17 20:36:55 skrev Brendan Cully <brendan@kublai.com>:
> 
> >On Wednesday, 17 April 2013 at 11:49, Nikolaj Sjujskij wrote:
> >>Brendan, while we're at it. Another questionable change made in zsh.git:
> >>
> >>diff --git a/contrib/zsh_completion b/contrib/zsh_completion
> >>--- a/contrib/zsh_completion
> >>+++ b/contrib/zsh_completion
> >>@@ -564,8 +564,8 @@
> >> _hg_cmd_commit() {
> >>   _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts
> >>\
> >>   '(--addremove -A)'{-A,--addremove}'[mark new/missing files as
> >>added/removed before committing]' \
> >>-  '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:'
> >>\
> >>-  '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log
> >>file:_files -g \*.txt' \
> >>+  '(--message -m)'{-m+,--message}'[specify commit message]:text' \
> >>+  '(--logfile -l)'{-l+,--logfile}'[read commit message from specified
> >>file]:log file:_files' \
> >>   '(--date -d)'{-d+,--date}'[record datecode as commit date]:date
> >>code:' \
> >>   '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
> >>   '--amend[amend the parent of the working dir]' \
> >>
> >>Apart from difference in descriptions (which I intend to keep closer to
> >>help
> >>entries), there's two things:
> >> * should we really complete --logfile with .txt-files only? Doesn't
> >>sound like a big deal, but...
> >
> >I'm -1 on this.
>  -1 on completing only *.txt files (current situation) or changing it to
> complete all files?

Ah, I'd misread this. I think it assumes too much to only complete
.txt files here. I prefer completing anything.
Nikolaj Sjujskij - April 17, 2013, 5:32 p.m.
Den 2013-04-17 20:42:29 skrev Brendan Cully <brendan@kublai.com>:

> On Wednesday, 17 April 2013 at 20:40, Nikolaj Sjujskij wrote:
>> Den 2013-04-17 20:36:55 skrev Brendan Cully <brendan@kublai.com>:
>>
>> >On Wednesday, 17 April 2013 at 11:49, Nikolaj Sjujskij wrote:
>> >>Brendan, while we're at it. Another questionable change made in  
>> zsh.git:
>> >>
>> >>diff --git a/contrib/zsh_completion b/contrib/zsh_completion
>> >>--- a/contrib/zsh_completion
>> >>+++ b/contrib/zsh_completion
>> >>@@ -564,8 +564,8 @@
>> >> _hg_cmd_commit() {
>> >>   _arguments -s -w : $_hg_global_opts $_hg_pat_opts  
>> $_hg_subrepos_opts
>> >>\
>> >>   '(--addremove -A)'{-A,--addremove}'[mark new/missing files as
>> >>added/removed before committing]' \
>> >>-  '(--message -m)'{-m+,--message}'[use <text> as commit  
>> message]:text:'
>> >>\
>> >>-  '(--logfile -l)'{-l+,--logfile}'[read commit message from  
>> <file>]:log
>> >>file:_files -g \*.txt' \
>> >>+  '(--message -m)'{-m+,--message}'[specify commit message]:text' \
>> >>+  '(--logfile -l)'{-l+,--logfile}'[read commit message from specified
>> >>file]:log file:_files' \
>> >>   '(--date -d)'{-d+,--date}'[record datecode as commit date]:date
>> >>code:' \
>> >>   '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
>> >>   '--amend[amend the parent of the working dir]' \
>> >>
>> >>Apart from difference in descriptions (which I intend to keep closer  
>> to
>> >>help
>> >>entries), there's two things:
>> >> * should we really complete --logfile with .txt-files only? Doesn't
>> >>sound like a big deal, but...
>> >
>> >I'm -1 on this.
>>  -1 on completing only *.txt files (current situation) or changing it to
>> complete all files?
>
> Ah, I'd misread this. I think it assumes too much to only complete
> .txt files here. I prefer completing anything.

Thanks, sent minipatch.

Patch

diff --git a/contrib/zsh_completion b/contrib/zsh_completion
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -564,8 +564,8 @@ 
  _hg_cmd_commit() {
    _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
    '(--addremove -A)'{-A,--addremove}'[mark new/missing files as  
added/removed before committing]' \
-  '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
-  '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log  
file:_files -g \*.txt' \
+  '(--message -m)'{-m+,--message}'[specify commit message]:text' \
+  '(--logfile -l)'{-l+,--logfile}'[read commit message from specified  
file]:log file:_files' \