Is there an easy way to separate the help-option from the ‘real’ program options? In fact, is it possible to define a hierarchy of options, a la BNF:
options := help_options | program_options
help_options := '-h'
program_options := '-m1' mode1options | '-m2' mode2options
mode1options := number
...
Or is there a better way to achieve this? Should I revert to spirit?
The documentation describes how to separate options under the Option Groups and Hidden Options heading. It demonstrates defining multiple
options_descriptionobjects and then using anallgroup for parsing the command line, but avisiblegroup for displaying documentation:Although the Program_options library lets you customize some of the syntax (see Non-conventional Syntax and Custom Validators), it doesn’t offer a way of defining a custom grammar. If you want to define the grammar of the command line, use a different tool.