Boost logo

Boost :

From: Jonathan Graehl (jonathan_at_[hidden])
Date: 2004-09-14 14:47:55

I used to do this:

>>bool help_flag;
>> ("help,h","produce help message");
>>But it's possible to make a typo and everything isn't in one place (I
>>prefer not to create a preprocessor macro to make "help" only occur once).
Now this is better:

>bool help_flag;
> ("help,h", bool_switch(&help_flag),"produce help message");

I tried it, and it works, but the usage string is a little odd:

  -h [ --help ] arg (=0) : produce help message
  -v [ --version ] arg (=0) : print the version number

I would have hoped that the "arg (=0)" part would not be displayed at
all for bool_switches. What would be the easiest way to suppress this?
Similarly, is there some easy to use hook for customizing the "arg" to
indicate the type of the data (similar to how the textual representation
of the default argument can be changed, e.g.
value<Infile>(&forests_file)->default_value(default_in,"STDIN"), so that
I could get something like: "-f filename (=STDIN) :" instead of "-f
arg (=STDIN) :"?


p.s. should I post this sort of question in boost-users? I'd have to
subscribe to it in order to post, so I didn't this time ...

Boost list run by bdawes at, gregod at, cpdaniel at, john at