$ git log -h fatal: unrecognized argument: -h $ git log --help fatal: unrecognized argument: --help
Maybe the usage string could be printed in those cases?
Nicolas
$ git log -h fatal: unrecognized argument: -h $ git log --help fatal: unrecognized argument: --help
Maybe the usage string could be printed in those cases?
Nicolas
Re: git log is a bit antisocial
Nicolas Pitre <nico@cam.org> writes:
> $ git log -h > fatal: unrecognized argument: -h > $ git log --help > fatal: unrecognized argument: --help > > Maybe the usage string could be printed in those cases?
Perhaps. Alternatively, "git help log", perhaps.
Re: git log is a bit antisocial
On Fri, 14 Apr 2006, Junio C Hamano wrote:
> Nicolas Pitre <nico@cam.org> writes: > > > $ git log -h > > fatal: unrecognized argument: -h > > $ git log --help > > fatal: unrecognized argument: --help > > > > Maybe the usage string could be printed in those cases? > > Perhaps. Alternatively, "git help log", perhaps.
What about git-log then?
Nicolas
Re: git log is a bit antisocial
Nicolas Pitre <nico@cam.org> writes:
> On Fri, 14 Apr 2006, Junio C Hamano wrote: > >> Nicolas Pitre <nico@cam.org> writes: >> >> > $ git log -h >> > fatal: unrecognized argument: -h >> > $ git log --help >> > fatal: unrecognized argument: --help >> > >> > Maybe the usage string could be printed in those cases? >> >> Perhaps. Alternatively, "git help log", perhaps. > > What about git-log then?
What about it?
Asking for help on log could be spelled as "git log --help" with a patch like the attached, but I am not sure that is worth it...
-- >8 --
diff --git a/git.c b/git.c index 78ed403..7fdacdd 100644 --- a/git.c +++ b/git.c @@ -497,6 +497,16 @@ int main(int argc, const char **argv, ch } argv[0] = cmd; + /* It could be git blah --help or git boo -h, but be + * careful; most commands have their own '-h' and '--help'. + */ + if (argc == 2 && + (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) { + argv[0] = "help"; + argv[1] = cmd; + exit(cmd_help(1, argv, envp)); + } + /* * We search for git commands in the following order: * - git_exec_path()
Re: git log is a bit antisocial
Le vendredi 14 avril 2006 à 14:28 -0700, Junio C Hamano a écrit :
> What about it? > > Asking for help on log could be spelled as "git log --help" with > a patch like the attached, but I am not sure that is worth it...
I would say that it is very useful to newbies, or simply not to frustrate users trying to get help. It is really worth it, at least for me.
-- Sébastien
Re: git log is a bit antisocial
Sébastien Pierre <sebastien@xprima.com> writes:
> Le vendredi 14 avril 2006 à 14:28 -0700, Junio C Hamano a écrit : > >> What about it? >> >> Asking for help on log could be spelled as "git log --help" with >> a patch like the attached, but I am not sure that is worth it... > > I would say that it is very useful to newbies, or simply not to > frustrate users trying to get help. It is really worth it, at least for > me.
Have you read the patch, especially the comment in it? With and without the patch, this command would behave quite differently:
$ git commit --help
Re: git log is a bit antisocial
Le vendredi 14 avril 2006 à 15:06 -0700, Junio C Hamano a écrit :
> Have you read the patch, especially the comment in it? With and > without the patch, this command would behave quite differently:
I did not realize that at first (I thought this would be a fallback method).
Anyway, on git 1.2.3, here is something interesting:
>> git log -h
fatal: Not a git repository
>> git log --help
Usage: /home/sebastien/Local/bin/git-log [--max-count=<n>] [<since>..<limit>] [--pretty=<format>] [git-rev-list options]
Which is confusing, so having a consistent behaviour for "git help cmd", "git cmd help", "git cmd -h" and "git cmd --help" would be nice.
For instance, Darcs works just like that, which makes it easy for newbies to find there ways through.
-- Sébastien
Re: git log is a bit antisocial
Sébastien Pierre <sebastien@xprima.com> writes:
> Anyway, on git 1.2.3, here is something interesting: > >>> git log -h > fatal: Not a git repository > >>> git log --help > Usage: /home/sebastien/Local/bin/git-log [--max-count=<n>] > [<since>..<limit>] [--pretty=<format>] [git-rev-list options]
You are talking about old codebase in the maitenance branch, which is an independent issue, but thanks for noticing anyway.
The attached patch would help with that.
> Which is confusing, so having a consistent behaviour for "git help cmd", > "git cmd help", "git cmd -h" and "git cmd --help" would be nice. > > For instance, Darcs works just like that, which makes it easy for > newbies to find there ways through.
Patches welcome, but a new development should be based on the "master" branch, not the maintenance 1.2.X series.
-- >8 --
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 025ef2d..d15747f 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -30,7 +30,7 @@ else fi case "$1" in - --h|--he|--hel|--help) + -h|--h|--he|--hel|--help) echo "$LONG_USAGE" exit esac