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

Dynamically adjust width of long option name column #360

Closed
remkop opened this issue Apr 15, 2018 · 0 comments
Closed

Dynamically adjust width of long option name column #360

remkop opened this issue Apr 15, 2018 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented Apr 15, 2018

The current layout (up to and including 3.0-alpha-6) has a fixed width long option name column:
this column is always 24 characters, even if none of the options have a long option name.

This gives weird-looking usage help messages in some cases. For example:

def cli = new CliBuilder(name:'ls')
cli.a('display all files')
cli.l('use a long listing format')
cli.t('sort by modification time')
def options = cli.parse(args)
...

The usage message for this example is:

Usage: ls [-alt]
  -a                          display all files
  -l                          use a long listing format
  -t                          sort by modification time

Picocli should adjust the width of the long option name column to the longest name (max 24).

Side note: the effective max width for long options is 20, since 4 characters out of that 24 are padding: 1 initial leading space, and 3 trailing spaces. Long options that are longer than 20 characters cause the long option column to "overflow" into the description column, and description to be displayed on the next line.

@remkop remkop added this to the 3.0 milestone Apr 16, 2018
remkop added a commit that referenced this issue Apr 18, 2018
@remkop remkop changed the title Proportional column width Dynamically adjust width of long option name column Apr 18, 2018
@remkop remkop closed this as completed in 287908e Apr 18, 2018
remkop added a commit that referenced this issue Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant