Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not enough space for descriptive help text #14

Open
pjfl opened this issue May 28, 2015 · 8 comments
Open

Not enough space for descriptive help text #14

pjfl opened this issue May 28, 2015 · 8 comments

Comments

@pjfl
Copy link

pjfl commented May 28, 2015

From the 0.99 change log "options that take arguments now indicate the argument's type and whether it
can be given multiply"

The arguments now take up some 48 characters as opposed to 28 characters in version 0.98. This squidges
the help text into 32 characters (on an 80 column terminal) and that looks ridiculously short.

Would you please make this change optional so that the original behaviour can be restored?

@pjfl
Copy link
Author

pjfl commented May 30, 2015

I've written a subclass of GLD::Usage which can do the old behaviour, the new behaviour and now that I've
thought about it my prefered behaviour so I'm happy. Thanks for prompting me to do this

Whilst doing that I noted that
https://github.com/rjbs/Getopt-Long-Descriptive/blob/master/lib/Getopt/Long/Descriptive/Usage.pm#L149
might be wrong. Should that not be comparing with 1
Also
https://github.com/rjbs/Getopt-Long-Descriptive/blob/master/lib/Getopt/Long/Descriptive/Usage.pm#L163
that extra + 1 is, I think, a kludge

@rjbs
Copy link
Owner

rjbs commented Jul 25, 2015

Given input: "abc|d|e" the while loop will fire with pos of 4 and 6. At 4, pos minus lastpos is 4. Not short, good. At 6, post minus lastpos is 2. Short, good. Then we get to the post-while condition. length is 7. length minus lastpos is 1. short should be true, so we should check == 1.

Yes, I agree, line 149 should be 1.

I also agree with that +1, since the formatter later inserts a space of its own.

@rjbs
Copy link
Owner

rjbs commented Jul 25, 2015

Would you consider a PR to add the optional old behavior? Do you think it's worth adding? Seems plausibly useful.

@randstring
Copy link

The maximum width for help text is too restrictive and if you have long option names multiple names for some options, help text will be limited to few characters, which looks ridiculous.

Would it be possible to provide configurable line width, instead of assuming 80, which is antiquated and not suitable for most present day users?
This way, I'd be able to use something like Term::ReadKey to actually get terminal size and pass the width option, or perhaps you could do it in GLD::Usage?

@SineSwiper
Copy link

Running into this myself:

        -f STR... --file STR... --files STR...    Apply only the requested
                                                  file(s). Option can appear
                                                  multiple times to request
                                                  multiple files, or files
                                                  can be separated by commas,
                                                  semi-colons, or colons in
                                                  one argument

<continued descriptions at a paltry 27 characters per line>

A few things could be solved here:

  1. Eight spaces before the options is rather wasteful. Looking at help screens for ack, grep, mysql, they are only using two. The same goes for the four spaces between the options and description.
  2. If there are a few alternates, consider putting them on separate lines.
  3. The 78 character max limit is hardcoded. Yeah, yeah, people still think we're living in the 1970s with monochrome green-screen terminal consoles, but this should really be an option to change.

Here's what it looks like if just 1&2 were solved:

  -f STR...       Apply only the requested file(s). Option can appear
  --file STR...   multiple times to request multiple files, or files can be
  --files STR...  separated by commas, semi-colons, or colons in one argument

@SineSwiper
Copy link

Another form I spotted in mysql's output:

  --auto-vertical-output
                      Automatically switch to vertical output mode if the
                      result is wider than the terminal width.

Basically, there's an upper limit on the size of descriptive options, and if it goes past that, the description ends up on the next line.

@rjbs
Copy link
Owner

rjbs commented Feb 20, 2018

Doing that last form should be easy:

[ "auto-vertical-output", "..." ],
[ "Automatically switch to vertical output mode if the result is wider than the terminal width." ],

It's not ideal, and I'll make it better soon, but it works.

I hope you'll see other improvements in this area in the not too distant future. I'll leave this task open to comment on improvements if and when they happen.

@SineSwiper
Copy link

Unfortunately, that fix still pushes the descriptions back to the 27 character limit, since the first line still has the long list of switches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants