I would like that a text is printed before the description of the allowed options when I print my options_description. Something like :
This program counts from 1 to 10. <--- this is what is missing
Generic options:
-h [ --help ] Produce help message.
-v [ --version ] Show program name/version banner and exit.
Currently I add it by hand :
if (vm.count("help")) {
cout << "options_description\n\n" << my_options_description << endl;
return 1;
}
Is it possible to store this directly in the options_description object ?
The
options_descriptionclass is for describing the options, not the program. The Program_options library isn’t really intended for general-purpose documentation.I suppose you could abuse the label: