Q:

Using boost program_options, select sets of options based upon one mandatory 'mode' option

Lets presume I have a number of option groups called modeA modeB common.  I'll refer to these within {} - ie {common} expands to any option described in that group. 
I'd like to be able to enforce the following command lines
command A {common} {modeA}
command B {common} {modeB}

The position of options from the mode and common groups is not important and can be intertwined
The following would fail
command A {modeB}    /* Wrong option group for this mode */
command A B          /* A and B not allowed */

Thus the objectives are

an option that must occur and be one of the set A|B

if possible forced to be the first parameter

whole groups parsed as Ok or ignored based upon the above mandatory parameter

A:

Not an elegant solution but ...
Divide the options into at least three groups, options for modeA/modeB and others.  Others contain help and the mode optons.  Use a custom validator for mode to limit the options (with a default) Then

Combine all groups and parse
Action --help if required (Explain all modes/options)
Determine mode
Make new group combination leaving out unrequired mode and re-parse  

I feel there must be a slicker way 

