program-options, --switch and --no-switch

Any suggestion on how to implement the common gnu idiom: --switch and --no-switch? bool_switch seems perfect for implementing --switch, but what about --no-switch (which should set switch_value to false)?

Hi Neal,
Any suggestion on how to implement the common gnu idiom:
--switch and --no-switch?
bool_switch seems perfect for implementing --switch, but what about --no-switch (which should set switch_value to false)?
What do you think about the approach in examples/custom_syntax.cpp? - Volodya

Vladimir Prus wrote:
Hi Neal,
Any suggestion on how to implement the common gnu idiom:
--switch and --no-switch?
bool_switch seems perfect for implementing --switch, but what about --no-switch (which should set switch_value to false)?
What do you think about the approach in examples/custom_syntax.cpp?
- Volodya
I think it's not documented. I don't see any mention of extra_parser in: file:/usr/local/src/boost_1_32_0/doc/html/program_options/reference.html Am I missing something?

Neal D. Becker wrote:
Vladimir Prus wrote:
Hi Neal,
Any suggestion on how to implement the common gnu idiom:
--switch and --no-switch?
bool_switch seems perfect for implementing --switch, but what about --no-switch (which should set switch_value to false)?
What do you think about the approach in examples/custom_syntax.cpp?
- Volodya
I think it's not documented.
Actually, http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/program_opti... is supposed to discuss that example.
I don't see any mention of extra_parser in: file:/usr/local/src/boost_1_32_0/doc/html/program_options/reference.html
You're right, unfortunately :-( I've added some comments, on trunk and release branch, and would suggest that you just copy the usage of 'extra_parser' from the example. - Volodya
participants (2)
-
Neal D. Becker
-
Vladimir Prus