Boost logo

Boost Users :

Subject: [Boost-users] Program Options - options dependencies
From: Angelo Mondaini (oangelo_at_[hidden])
Date: 2014-07-02 16:11:22


Dear all,

I am using the Program Options and I would like to know if I can add
options dependencies through the lib.
For example, consider a "test" program that has a flag
"--has-dependencies" that needs a flag "--dependency" and a flag
"--no-depenencies".

It would run like this:
$./test --no-dependencies
Program running...
$./test --has-dependencies
Error! Flag "--dependency" is needed!
$./test --has-dependencies --dependency
Program running...

PS: I know I can use something like this, but I would like to know if there
is a better option:
if ( vm.count("--has-dependencies") )
  if ( vm.count("--dependency") )
    //do something...
  else
    //trow an error



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net