it would be handy to have a callback value option so that, e.g., the '--help' option could call a 'long_help' function instead of returning a string
Can you provide an example, maybe what you'd like the API to look like and an example of what a function might do?
TCLAP::SwitchArg h_arg("?", // short option char
"long-help", // long option name, if any
"Extended help.", // short description string
cmd, // add to 'cmd' object
&long_help); // call-back function
When the '-?' or '--long-help' is found on the command line, TCLAP calls the function 'long_help' and exits. The long_help func might look something like this:
printf("This is the first line of many lines of examples and\n"
// ... maybe output an example file...
// and tell the user about it:
printf("See example file 'example.dat'.\n");
// program exits after return from this function
I think I can do the desired thing with a Visitor, so I consider this request closed.
Log in to post a comment.