It's not ideal, but how about creating a "dummy" set of program options, let the boost::program_options formatter format its help text for you, and then just remove the dashes with a quick replace?
Then output that help text in addition to the options
help text.
Something like this:
po::options_description dummy_options("Operands");
dummy_options.add_options()
("file1", po::value<std::string>(), "A pathname of the first file to be compared. If file1 is '-', the standard input shall be used.")
("file2", po::value<std::string>(), "A pathname of the second file to be compared. If file2 is '-', the standard input shall be used.")
;
std::stringstream s;
s << dummy_options;
std::string dummy_help_text = s.str();
boost::replace_all(dummy_help_text, "--", "");
boost::replace_all(dummy_help_text, "arg", " ");
std::cout << dummy_help_text << std::endl;
The output looks like this:
Operands:
file1 A pathname of the first file to be compared. If file1
is '-', the standard input shall be used.
file2 A pathname of the second file to be compared. If file2
is '-', the standard input shall be used.
It's not ideal because, among other things, the the spacing between columns will not match the help output from your other options
output. But for something quick-and-dirty, that basically works, it could be OK.
It's a thought, anyway.
(I do not see anything in the Boost.Program_Options API that allows you to do this the "right" way, either. https://stackoverflow.com/a/3621947/368896 gives a hint that this sort of thing is not supported, but that is 3 years old now.)