git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Giuseppe Scrivano <gscrivano@gnu.org>
Cc: git@vger.kernel.org
Subject: Re: [RFC][PATCH] Print the usage string on stdout instead of stderr.
Date: Mon, 17 May 2010 15:30:48 +0200	[thread overview]
Message-ID: <4BF14508.8040307@drmicha.warpmail.net> (raw)
In-Reply-To: <87vdamu2es.fsf@thor.thematica.it>

Giuseppe Scrivano venit, vidit, dixit 17.05.2010 14:40:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> More importantly, callers expect error messages on stderr, such as usage
>> with wrong arguments. I don't think scripts would call commands with
>> '-h', and if they do they do so on purpose and can parse stderr, knowing
>> there is no stdout in this case.
> 
> It looks like a workaround to me.  Anyway, if -h is left unchanged then,
> I think, --help should be adjusted as well when it doesn't use an
> external pager.
> 
> These two commands behave differently:
> 
> git status --help 2>/dev/null | cat -
> git status -h 2>/dev/null | cat -

They also do two very different things. The first one displays the man
page, the second the usage string.

> IMO, what should be changed is -h to be uniform with --help, as the it
> is the expected output, not an error.

That is not what your patch does.

I'm not opposed to having -h output on stdout. I'm opposed to having
usage error messages on stdout. Currently, both are on stderr, which is
no problem (we're not bound by GNU rules here).

Your patch puts both on stdout, and that is a problem, not only for
several test which could be adjusted, but also for scripters.

A patch which *really* only changes '-h' to use stdout would certainly
not be objected. Actually, most calling sites are probably the "error
case" so that you only need to make sure that the "-h" path get's to use
a different output file descriptor.

Cheers,
Michael

  reply	other threads:[~2010-05-17 13:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17  9:48 [RFC][PATCH] Print the usage string on stdout instead of stderr Giuseppe Scrivano
2010-05-17 11:46 ` Michael J Gruber
2010-05-17 12:07   ` Miles Bader
2010-05-17 13:30     ` Michael J Gruber
2010-05-17 13:54       ` Miles Bader
2010-05-17 14:07       ` Giuseppe Scrivano
2010-05-17 14:11         ` Tay Ray Chuan
2010-05-17 12:40   ` Giuseppe Scrivano
2010-05-17 13:30     ` Michael J Gruber [this message]
2010-05-17 16:02       ` Giuseppe Scrivano
2010-05-18  9:43         ` Michael J Gruber
2010-05-24 20:51           ` Giuseppe Scrivano
2010-05-25  6:46             ` Michael J Gruber
2010-05-25  8:40               ` [PATCH v2] " Giuseppe Scrivano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BF14508.8040307@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gscrivano@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).