libre-man / unix-opts

Unix-style command line options parser
MIT License
107 stars 13 forks source link

only pad opt descriptions to a max of argument-block-width #31

Open travv0 opened 3 years ago

travv0 commented 3 years ago

This might be me misunderstanding the intent, but when adding a newline after a long option name, it's indented like this:

  -p, --path SOME_LONG_TEXT_HERE
                                 This is the path to do something to.
  -n, --name NAME                Your name.

which doesn't seem like the newline is helping anything since the line's the same length as if it was just:

  -p, --path SOME_LONG_TEXT_HERE This is the path to do something to.
  -n, --name NAME                Your name.

This patch makes it left-pad the descriptions to a maximum of argument-block-width which I personally think makes a lot more sense, as that's the point when they're put on the next line.

So instead for a block width of 25 it would look like:

  -p, --path SOME_LONG_TEXT_HERE
                         This is the path to do something to.
  -n, --name NAME        Your name.

Let me know what you think. I'll wait to see what you think before updating the tests.

libre-man commented 3 years ago

I totally agree your version is way better, so please do add tests!