mpeterv / argparse

Feature-rich command line parser for Lua
MIT License
251 stars 43 forks source link

Prettier help strings. #15

Closed bardes closed 5 years ago

bardes commented 6 years ago

I know this is a bit on the opinion side but it would be nice to have linebreaks between the options for easier readability. I'd also change the way long options are listed from:

-o <output>, --output <output>
                         Output file.

to:

--output <output>,
      -o <output>
                     Output file.

That is: stack multiple long options above each other, left pad them, and reduce the margin to allow for longer and more readable descriptions.

mpeterv commented 6 years ago

I like the idea of having vertically aligned argument lists when displaying multiple aliases for an option. Probably not for simple flags though:

    -h,
--help
                     Show this help message and exit.

wastes too much space IMO.

Also, it makes sense to start outputting the description from the very first line if it fits after the option name and arguments. So, instead of

--output <output>,
      -o <output>
                     Output file.
                     Some more words.
                     And more descriptions.

show this:

--output <output>,   Output file.
      -o <output>    Some more words.
                     And more descriptions.
mpeterv commented 6 years ago

Implemented on master branch.

mpeterv commented 6 years ago

I'll also add a way to space out help messages for different options with a parser property.

mpeterv commented 6 years ago

Added parser properties on master branch:

Plus also usage_margin and usage_max_witdh for configuring generation of the usage string at the top of help.

daurnimator commented 5 years ago

@bardes I think the issue is fixed? could you close it?