Re: [PATCH 0/25] Usage message clean-up
- From
A Large Angry SCM <gitzilla@gmail.com>
- Date
- Dec 10, 2005, 22:13 UTC
- Message-ID
- <439B5325.8000504@gmail.com>
- In-Reply-To
- <1134243476675-git-send-email-freku045@student.liu.se>
freku045@student.liu.se wrote: ...
> I have tried to follow the following rules: > > * Any unrecognised options should make the script die with the usage > message.
Good.
> * -h and --help makes the script die with the usage message.
This should not be an error. The user was asking for the usage message.
> * The message is printed to stderr.
Good unless the message was printed due to -h or --help, then it should go to stdout.
Show 7 quoted lines
> * The message is of the form "usage: $0 options" > > I am not convinced that the last bullet point is the best way to do > things. Using "$0" is probably best for Git developers but using "git > program-name" is probably least confusing for users, especially if we > are going to move the git-* binaries away from /usr/bin. Another > option is "basename $0". What do you think?
Not using $0 can make it _extremely_ annoying to determine exactly which program printed the usage message. It may look prettier without the path but if I have more that one $(basename $0) it may not be trivial to determine the one that issued the message. Also keep in mind that is it possible to have spaces in names of executables. So, "foo-bar" and "foo bar" may be two different executables.