[dev] Re: [dev] [dev] Usage, -h, --help, help, synopsis, …

From: Alexander Teinum <ateinum_AT_gmail.com>
Date: Tue, 17 Aug 2010 20:07:05 +0200

> I think the best format for usage is something like what Plan 9
> utilities use (BSD use the same):
>
> usage: cmd [-abcde] [-f file] [-g pattern] [file ...]

Options without values are combined? Is that correct?

> With these rules flo usage should be
>
> usage: flo [-c id] [-f from] [-r id] [-t to] [-w what] [what[,from][-to]]

What if the values are of the same type? -c and -r have id as value.
-f and -t have date as value. I think your usage-text looks prettier,
but out of curiosity, can they be combined like this?

usage: flo [-cr id] [-ft date] …

If I decide to ditch getopt(), then I’d like to be able to type “flo
-c -f” to clear the from-field, which means that -f and -t have
optional arguments. Is it valid for an option to have an optional
argument?

If it is, which of the following is correct?

1. usage flo: [-f [from]] [-t [to]]

2. usage flo: [-ft] [-f from] [-t to]

3. usage flo: [-f from] [-t to]

4. usage flo: [-ft]

I found some guidelines here:

http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_01c

Do you agree with the guidelines listed in 12.2? I’ll find a pen and a
paper and try to digest those.
Received on Tue Aug 17 2010 - 20:07:05 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 17 2010 - 20:12:02 CEST