I will answer my own question so that it may help someone else in the future.
I ran across a code snippet on the net that hinted at a solution and lead me to an answer. In short, there is no CLI11 method to directly print out the help text. However, there are two ways to print the help text programmatically.
try/catch block
This the CLI11 native method. After you have set up all your option definitions, define a try/catch block as in:
CLIx::App app( argc,
argv );
.
.
.
try
{
app.parse( argc,
argv);
}
catch( const CLI::CallForHelp &e )
{
exit( app.exit( e ) );
}
The line "exit( app.exit( e ) );" calls the app parser method "exit" which prints the help text and returns an errorcode to exit the program. Then when you want help text printed, simply do a throw:
throw CLI::CallForHelp();
This exception is never described in any if the documentation, and is only discovered by crawling through CLI11's source.
sort of directly, slightly clumsy
The previous method assumes you want to exit the program after printing the help text. In my case that wouldn't work since I have users entering commands with options at an interactive prompt as part of my program. Instead, you can call CLI11's exit method directly with a fake exception:
app.exit( CLI::CallForHelp() );
Kind of goofy, but gets the job done.
Again, nowhere is this documented anywhere and is only discover by going through the CLI11 code.
Lastly, despite this little wart, I highly recommend CLI11. It's easy to use and quite powerful.