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

From: pancake <pancake_AT_youterm.com>
Date: Wed, 18 Aug 2010 00:19:34 +0200

Plan9 getopt replacement is quite nice. I recommend the reading. Maybe a port would be good. Dunno if its in 9base.. But it should be enought with a .h and few defines

----- Original message -----
> Hey,
>
> > 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.
>
> cls
>
Received on Wed Aug 18 2010 - 00:19:34 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 18 2010 - 00:24:02 CEST