cxxopts
cxxopts copied to clipboard
Indentation in help
Hello, I am currently using the cxxopts help function to print usage info for all the options of my program. The thing is that I want to write multiple lines for each option and I use and I see that the text gets indented on multiple lines.
Here is an example. This is my code:
options.add_options()
("a,add", "This is the help for add option\n\te.g. --add 1 2 3 test\n\te.g. --add 4 5 6 test2", cxxopts::value<std::string>(), "NUMBER")
;
std::cout << options.help();
This is the output:
I have found a work-around. If i modify //widest allowed description
from 76 to a number big enough, say 1000. The output is fine.
Maybe it will be useful to have a way to print the help string unformatted. Thank you.
That doesn't look right. I'll take a look.
What do you mean by "unformatted"?
I think part of the problem is that I never designed this thinking that users would put their own new lines in the help description. I generally intended the help description to be a simple one or two sentence as assistance, and that further help would go somewhere else.
#215 was recently merged that allows new lines and does tab expansion. Can you have a look at that and see if it helps?
There is an example in the old #213.