I wrote a small app that uses boost::program_options for command-line parsing. I'd like to have some options that set a value if the argument is present, and alternately prints the current value if the parameter is given but no argument is present. So "set-mode" would look like:
dc-ctl --brightness 15
and "get mode" would be:
dc-ctl --brightness
brightness=15
The problem is, I don't know how to handle the second case without catching this exception:
error: required parameter is missing in 'brightness'
Is there an easy way to avoid having it throw that error? It happens as soon as the arguments are parsed.