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

From: Connor Lane Smith <cls_AT_lubutu.com>
Date: Tue, 17 Aug 2010 19:35:15 +0100


> Options without values are combined? Is that correct?

Can be. Though, many suckless projects don't accept this and use, eg,
strcmp(argv[i], "-sb"). A number of non-suckless programs are similar.

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

This would lead me to think that there were options '-cr' and '-ft'.
Separating them would be better.

> Is it valid for an option to have an optional argument?

Depends what you mean by "valid". It's extremely weird. You'd have to
process the next argument to determine whether it is another flag or a
value for the current option. It would also be very confusing to use.
I'd avoid it if I were you.

I spent some time thinking about this for dmenu. Its usage wraps to 80
columns, has lists flags separately first. Regarding '-h' flags, just
make sure you don't create another meaning for '-h' and using it will
automatically spark usage.

Received on Tue Aug 17 2010 - 20:35:15 CEST

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