[program_options] Parsing config files

Hello, Need a little help grasping the nature of parse_config_file. The example: http://www.boost.org/doc/libs/1_54_0/doc/html/program_options/tutorial.html#... also seems a bit lacking: says that there are two calls to store, but I only see one. Maybe the example has not been updated? What I need to know is, if we specify some options, do we specify the same option names in a config file? So that if we have an option on the command like like: --my-option-name 1234, then the corresponding line in the config file would go: my-option-name=1234 ? Thank you. Regards, Michael Powell

Haven't run it through all of our use cases yet, but so far so good,
works pretty good (knock on wood).
Next obvious question, that's well and good for options with values.
How about for non-value type options: i.e. the key just exists.
For instance, "--some-time-out 1000" works well. However, what about
for "--simple-flag" ?
So far I seem to be getting parse errors, but I don't know if it's a
format issue, or there is another way to specify the options.
Thanks.
On Thu, Aug 8, 2013 at 10:10 AM, Rhys Ulerich
So that if we have an option on the command like like: --my-option-name 1234, then the corresponding line in the config file would go: my-option-name=1234 ?
So far as I understand, yes.
- Rhys _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Great. Thank ye sir!
On Thu, Aug 8, 2013 at 11:30 AM, Rhys Ulerich
How about for non-value type options: i.e. the key just exists.
For instance, "--some-time-out 1000" works well. However, what about for "--simple-flag" ?
So far I seem to be getting parse errors...
This bit me too. IIRC, 'simple-flag=' with no value.
- Rhys _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Works like a champ!
Last question I think: when it comes to prioritizing options
preference, I'd like to prefer command line over configuration file:
in other words, give the end-user an opportunity to override the
configuration file on the command line.
So, to do this, first parse the configuration file? Then parse the
command line? Or vice versa?
Thank you...
On Thu, Aug 8, 2013 at 11:35 AM, Michael Powell
Great. Thank ye sir!
On Thu, Aug 8, 2013 at 11:30 AM, Rhys Ulerich
wrote: How about for non-value type options: i.e. the key just exists.
For instance, "--some-time-out 1000" works well. However, what about for "--simple-flag" ?
So far I seem to be getting parse errors...
This bit me too. IIRC, 'simple-flag=' with no value.
- Rhys _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Last question I think: when it comes to prioritizing options preference, I'd like to prefer command line over configuration file: in other words, give the end-user an opportunity to override the configuration file on the command line.
I do CLI first and then any option files. - Rhys

Can you confirm?
On Thu, Aug 8, 2013 at 12:39 PM, Rhys Ulerich
Last question I think: when it comes to prioritizing options preference, I'd like to prefer command line over configuration file: in other words, give the end-user an opportunity to override the configuration file on the command line.
I do CLI first and then any option files.
I can do configuration files, but it doesn't seem to matter when I do
one versus the other. Once it is specified in the configuration file,
that one takes precedence.
Perhaps there is some parse option I can use to override options? I'd
like to do configuration file first, then override with CLI, if
possible.
Of course where po::value
- Rhys _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

...
On Thu, Aug 8, 2013 at 11:37 AM, Michael Powell
Works like a champ!
Last question I think: when it comes to prioritizing options preference, I'd like to prefer command line over configuration file: in other words, give the end-user an opportunity to override the configuration file on the command line.
So, to do this, first parse the configuration file? Then parse the command line? Or vice versa?
Doesn't seem to matter which order I put them in. The configuration file always wins. I'd rather it was the command line that wins. Interesting, and somewhat expected, that when I specify a mutually exclusive set of options, the process runs and parses and responds to the options as expected. Anyone? Thank ye...
Thank you...
On Thu, Aug 8, 2013 at 11:35 AM, Michael Powell
wrote: Great. Thank ye sir!
On Thu, Aug 8, 2013 at 11:30 AM, Rhys Ulerich
wrote: How about for non-value type options: i.e. the key just exists.
For instance, "--some-time-out 1000" works well. However, what about for "--simple-flag" ?
So far I seem to be getting parse errors...
This bit me too. IIRC, 'simple-flag=' with no value.
- Rhys _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

I stand corrected. It works! Was a stuck-ness in a static library of
ours. I cleaned and rebuilt that and now it works.
Sorry for any confusion...
On Thu, Aug 8, 2013 at 2:02 PM, Michael Powell
...
On Thu, Aug 8, 2013 at 11:37 AM, Michael Powell
wrote: Works like a champ!
Last question I think: when it comes to prioritizing options preference, I'd like to prefer command line over configuration file: in other words, give the end-user an opportunity to override the configuration file on the command line.
So, to do this, first parse the configuration file? Then parse the command line? Or vice versa?
Doesn't seem to matter which order I put them in. The configuration file always wins. I'd rather it was the command line that wins.
Interesting, and somewhat expected, that when I specify a mutually exclusive set of options, the process runs and parses and responds to the options as expected.
Anyone?
Thank ye...
Thank you...
On Thu, Aug 8, 2013 at 11:35 AM, Michael Powell
wrote: Great. Thank ye sir!
On Thu, Aug 8, 2013 at 11:30 AM, Rhys Ulerich
wrote: How about for non-value type options: i.e. the key just exists.
For instance, "--some-time-out 1000" works well. However, what about for "--simple-flag" ?
So far I seem to be getting parse errors...
This bit me too. IIRC, 'simple-flag=' with no value.
- Rhys _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Michael Powell
-
Rhys Ulerich