I am using Boost Program Options to parse command line arguments (and I don't want to miss it since it works great). However, I have one problem: Boost program options offer the possibility to assign a description to each option. Boost then offers the possibility to
cout << program_options_description << endl
to nicely display help explaining the options. However, it seems to be the case that these error messages are adjusted to a terminal width of 80 (I conclude this from the fact that for a width of 80, the line breaks are nicely set).
If my current terminal has another width (in particular one that has less than 80 columns), the displayed help looks very unnatural due to automatic line breaks done by the terminal.
So: Is there a possibility that Boost automatically adjusts the option descriptions to the current terminal width?
The options_description accepts the column width as a parameter.
options_description(const std::string &, unsigned = m_default_line_length,
unsigned = m_default_line_length/2);
I believe the default is 80 for m_default_line_length
. Also, see this SO question to get the terminal width on linux and then pass that to the constructor. Or if you are windows, you would want to call GetConsoleScreenBufferInfo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With