cxxopts
cxxopts copied to clipboard
Add a print function for the option object
I think that a print() function can be useful to print out the configurations parsed by the user. The description can be reused during the printing.
cxxopts::Options options;
auto result = options.parse(argc, argv);
options.print(result);
What sort of information would you like printed that would be different from what help
prints?
@jarro2783
The current help print like this
--log_level arg Log level (default: 3)
--network arg Network file name
--id arg Network id name (default: id)
When the user types
--log_level 5 --network foo.txt --id gid
I would like to have
--log_level arg 5
--network arg foo.txt
--id arg gid
I frequently encounter this need when I want to confirm the input argument is correct and record it in the log file.
For what it is worth, in the last project where I used cxxopts
, I wrote code nearly identical to this. Before beginning a long period of computation, I had it list all the parameters it was using.
Ok that makes. So you actually want it to print out the ParseResult
object so you know what it has actually parsed.