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

fix: help command spacing when scriptName is empty #1994

Merged
merged 4 commits into from Aug 16, 2021
Merged

fix: help command spacing when scriptName is empty #1994

merged 4 commits into from Aug 16, 2021

Conversation

CupOfTea696
Copy link
Contributor

When settings the scriptName to an empty string, the help command will add an unnecessary whitespace before commands, and wrap the command usage string 1 character too early. This PR fixes this.

@CupOfTea696 CupOfTea696 changed the title Fix help command list when scriptName is empty Fix: help command list when scriptName is empty Jul 25, 2021
@CupOfTea696
Copy link
Contributor Author

Example:

When using

yargs()
  .scriptName('')
  .command('group', 'Rule groups')
  .command('rule', 'Rule management')
  .command('help [command] [subcommand]', 'Show help')

Output:

Commands:
   group                       Rule groups
   rule                        Rule management
   help [command] [subcommand  Show help
  ]

With fix:

Commands:
  group                        Rule groups
  rule                         Rule management
  help [command] [subcommand]  Show help

@bcoe
Copy link
Member

bcoe commented Aug 4, 2021

@CupOfTea696 thank you for the contribution 👏 right now this looks to be breaking a couple tests, mind taking a look?

@CupOfTea696
Copy link
Contributor Author

@bcoe That should fix it.

@bcoe bcoe changed the title Fix: help command list when scriptName is empty fix: help command spacing when scriptName is empty Aug 13, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants