|
Boost Users : |
From: Peter Whaite (boost_at_[hidden])
Date: 2005-11-22 15:08:34
Vladimir Prus <ghost_at_[hidden]> wrote:
> Merrill Cornish wrote:
>
> > graph_file is a positional parameter. So should it be added to the
> > option_description list?
>
> Yes, how else would you specify the type of the value?
> positional_options_description only specifies translation from
> position on the command line to option name, the option still has to
> be registered. I've added a warning to the docs.
I'm sure a warning will help as that's not at all obvious in the current
documentation. A comment in the example would be useful too. It took
me a while for the penny to drop the first time I used this library.
FWIW my (now obviously erroneous) reasoning was that a
positional_options_description was just another kind of
options_description, and that "input-file" was in both of them in
example/program_options.cpp so it could be used as both an option and a
positional argument. I only wanted it as a positional parameter, so I
omitted it from the options_description.
I also found myself wanting to generate a usage message like this...
po::positional_options_description pd;
cout << "Usage: " << progname << " [options]" << pd << endl;
rather than having to loop through pd.
But these are minor things. Thank you for a very useful library.
--- Peter Whaite.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net