Search code examples
c++boost-program-options

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


Solution

  • 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