Re: [PATCH 04/10] shell helpers usage: always send help to stderr
- From
Stefan Beller <sbeller@google.com>
- Date
- May 2, 2016, 23:44 UTC
- Message-ID
- <CAGZ79ka7uPxLKVU7Dn-4yHyN1BMgeG33_7LJDShF3UVjrT2fgQ@mail.gmail.com>
- In-Reply-To
- <xmqqtwigox9x.fsf@gitster.mtv.corp.google.com>
On Mon, May 2, 2016 at 4:28 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Stefan Beller <sbeller@google.com> writes: > >> `git submodule asdf` would trigger displaying the usage of the submodule >> command on stderr, however `git submodule -h` would display the usage on >> stdout. Unify displaying help for shell commands on stderr. > > The primary output from "git cmd --help" is the usage message. It > is debatable why it should go to the standard error output when it > is the primary thing the user asked for.
I had written some lengthy arguments, but when I wanted to back up with data and facts, the first search result[1] convinced me this is a bad patch as when a user asks for help specifically, they want it to easily be piped, i.e.
git --help |grep pull
instead of
git --help 2>&1 |grep pull
So I'll drop this patch. Thanks, Stefan
[1] http://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout
Show 21 quoted lines
>
>
>
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>> git-sh-setup.sh | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
>> index c48139a..5c02446 100644
>> --- a/git-sh-setup.sh
>> +++ b/git-sh-setup.sh
>> @@ -65,7 +65,7 @@ say () {
>>
>> if test -n "$OPTIONS_SPEC"; then
>> usage() {
>> - "$0" -h
>> + "$0" -h 1>&2
>> exit 1
>> }