* Convention for help in git commands?
@ 2005-10-25 13:08 Josef Weidendorfer
2005-10-25 18:56 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Josef Weidendorfer @ 2005-10-25 13:08 UTC (permalink / raw)
To: git
Hi,
is there a commonly accepted way how to handle help messages
in git commands? In git-mv/git-rename, there is a full help
message with description of options when "-h" is given.
This seems to be the Cogito way; git commands seem to be used
to output an one-liner usage only, and rely on the man
page otherwise.
This should be more consistent. Proposal:
* All git commands should react on command line option "-h"
for help, dumping a few lines to stderr, prefixed by "usage:", giving
the command usage without further descriptions. For the usage
output, use the base name of the command, and not the absolute
path to the binary.
* For commands which need at least one argument, the usage
is also printed, if the command is run without argument
* On a error condition, prefix the message with "error:", and
do not print out anything else (like the usage line, or things
produced by the PERL "die", which appends "at scriptname line nn").
Perhaps these things should be done only for commands of the
git lightwight porcelain?
Josef
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Convention for help in git commands?
2005-10-25 13:08 Convention for help in git commands? Josef Weidendorfer
@ 2005-10-25 18:56 ` Junio C Hamano
2005-10-25 20:24 ` Martin Langhoff
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-10-25 18:56 UTC (permalink / raw)
To: Josef Weidendorfer; +Cc: git
Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:
> * All git commands should react on command line option "-h"
> for help, dumping a few lines to stderr, prefixed by "usage:", giving
> the command usage without further descriptions. For the usage
> output, use the base name of the command, and not the absolute
> path to the binary.
It drives me nuts when an error message shows only basename not
full path and I find out that I was running a wrong executable
much later after wasting a lot of time trying to debug it. But
I think "usage: " saying the basename only is user friendly and
a good convention.
> * For commands which need at least one argument, the usage
> is also printed, if the command is run without argument
This is slightly debatable. I'd rather see it error out for one
thing, and we might want to do a sane default given no arguments
later.
> Perhaps these things should be done only for commands of the
> git lightwight porcelain?
Probably.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Convention for help in git commands?
2005-10-25 18:56 ` Junio C Hamano
@ 2005-10-25 20:24 ` Martin Langhoff
2005-10-25 21:35 ` Josef Weidendorfer
0 siblings, 1 reply; 5+ messages in thread
From: Martin Langhoff @ 2005-10-25 20:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Josef Weidendorfer, git
On 10/26/05, Junio C Hamano <junkio@cox.net> wrote:
> > * For commands which need at least one argument, the usage
> > is also printed, if the command is run without argument
>
> This is slightly debatable. I'd rather see it error out for one
> thing, and we might want to do a sane default given no arguments
> later.
This could lead to subtle bugs when git is used by porcelains. If
there are going to be changes in default behaviours, let's have them
soon-ish ;-)
cheers,
martin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Convention for help in git commands?
2005-10-25 20:24 ` Martin Langhoff
@ 2005-10-25 21:35 ` Josef Weidendorfer
2005-10-25 22:07 ` Martin Langhoff
0 siblings, 1 reply; 5+ messages in thread
From: Josef Weidendorfer @ 2005-10-25 21:35 UTC (permalink / raw)
To: git
On Tuesday 25 October 2005 22:24, you wrote:
> On 10/26/05, Junio C Hamano <junkio@cox.net> wrote:
> > > * For commands which need at least one argument, the usage
> > > is also printed, if the command is run without argument
> >
> > This is slightly debatable. I'd rather see it error out for one
> > thing, and we might want to do a sane default given no arguments
> > later.
>
> This could lead to subtle bugs when git is used by porcelains. If
> there are going to be changes in default behaviours, let's have them
> soon-ish ;-)
What is the difference for a porcelain between error out,
presumable with an error message, and printing the usage alone?
Is there any dependency of porcelains to the fact the e.g.
"git-rev-list" currently does nothing if not called with a
commit-id? Somehow I think "git-rev-list" should give an error,
as the usage string (with lots of options on a line of its own ?!)
requires a commit-id as argument.
BTW, the error message of "mv" is:
===
mv: missing file operand
Try `mv --help' for more information.
===
What about something similar to this? Mentioning the command
which triggered the error is probably a good idea.
And I would add as another convention:
* "git-cmd -h" always should give the usage, and not error out
with "fatal: Not a git repository" before.
Josef
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Convention for help in git commands?
2005-10-25 21:35 ` Josef Weidendorfer
@ 2005-10-25 22:07 ` Martin Langhoff
0 siblings, 0 replies; 5+ messages in thread
From: Martin Langhoff @ 2005-10-25 22:07 UTC (permalink / raw)
To: Josef Weidendorfer; +Cc: git
On 10/26/05, Josef Weidendorfer <Josef.Weidendorfer@gmx.de> wrote:
> On Tuesday 25 October 2005 22:24, you wrote:
> > On 10/26/05, Junio C Hamano <junkio@cox.net> wrote:
> > > > * For commands which need at least one argument, the usage
> > > > is also printed, if the command is run without argument
> > >
> > > This is slightly debatable. I'd rather see it error out for one
> > > thing, and we might want to do a sane default given no arguments
> > > later.
> >
> > This could lead to subtle bugs when git is used by porcelains. If
> > there are going to be changes in default behaviours, let's have them
> > soon-ish ;-)
>
> What is the difference for a porcelain between error out,
> presumable with an error message, and printing the usage alone?
Sorry! My comment was aimed at the "do a sane default given no
arguments later" part of Junio's post. Error vs help messages don't
affect porcelains if you check your tty and avoid spitting out a help
message when invoked from a script ;-)
cheers,
martin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-10-25 22:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-25 13:08 Convention for help in git commands? Josef Weidendorfer
2005-10-25 18:56 ` Junio C Hamano
2005-10-25 20:24 ` Martin Langhoff
2005-10-25 21:35 ` Josef Weidendorfer
2005-10-25 22:07 ` Martin Langhoff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox