On 9/2/13 7:16 AM, Andrej Mitrovic wrote:
On 9/2/13, Jacob Carlborg <d...@me.com> wrote:
This is a simple idea:

uint timeout;
getopt(args, "timeout|t", &timeout).help("Set the timeout");

W.r.t. help strings, I would prefer if we could instead use:

getopt(args,
   "timeout|t", &timeout, "Set the timeout",
   "other", &other,  // note: no comment!
   "flag|f", &flag, "Set the flag")

I think we could make getopt support this. For example:

["foo", &foo] => name, field
["foo", &foo, "foo text"] => name, field, #3 is a comment
["foo", &foo, "foo text", "bar", &bar] => #3 is a commen
["foo", &foo, "foo text", &bar] => #3 is a new name

Essentially all getopt has to do is slice up the arguments into
groups, where an address and the string before it begin a new group.

@Andrei: What do you think?

Sounds great. There's a related bugzilla entry IIRC.

Andrei


Reply via email to