Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have an option enabling other options in Boost Program Options without using variables?

I use program options to parse the command line options of my application.

I have several options like -Ox, -Oy, -Oz, ... and I want to have a super option -Oall that enables Ox and Oy and another -Osub that enables Oz and Ow.

Is there a way to do that using Boost Program Options ?

At first, I wanted to check the value of Oall and then manually enables Ox and Oy, but it is not possible to edit values after the parsing.

I want to avoid using variables to store the values of Ox, Oy, because I can have a lot of theses options.

Thanks

like image 355
Baptiste Wicht Avatar asked Nov 14 '22 14:11

Baptiste Wicht


1 Answers

I see this more in your program's logic so I doubt Program Options provide this. Simply use

if (Oall)
{Ox = Oy = Oz = true;}

and such

like image 54
CharlesB Avatar answered Mar 30 '23 00:03

CharlesB