catchorg / Clara

A simple to use, composable, command line parser for C++ 11 and beyond
Boost Software License 1.0
649 stars 67 forks source link

Use COLUMNS environment variable for console width #14

Open vadz opened 8 years ago

vadz commented 8 years ago

If this variable is defined (which is not always the case but at least respecting it allows us to wrap things properly if it is), use it instead of the hard-coded 80 character line width.

Closes #7.


Notice that I had to update catch.hpp as well because otherwise I was getting incomprehensible errors from main.cpp which used Tbc::TextAttributes from there and not from clara.h itself. In fact, I think this points out a serious problem with the current stitching approach: it can easily result in ODR violations because the same stuff is stitched into both catch.hpp and clara.h. To solve this you'd need to use unique namespaces for the internal stuff for the two headers.

BTW, why does Clara use .h extension when CATCH uses .hpp? Wouldn't it be better to use the latter for Clara too, if only for consistency?

philsquared commented 8 years ago

Thanks for this. I'd like to use this PR at some point. My concern at the moment is that I think you've hit on a problem with a half-finished implementation of an idea. I think I need to do a bit more work on the stitching script as the TextAttributes lib should be independently embedded in both Clara and Catch - thus avoiding ODR (and other) issues. Unfortunately I haven't touched that for a while and I don't think it was completely finished. It's also a bit complex. So I'm going to need to do a big push to get that sorted - which I won't have time for for a while.

So I just wanted to let you know that I'm not ignoring this in the meantime.