Skip to content

fix: help command spacing when scriptName is empty#1994

Merged
bcoe merged 4 commits intoyargs:masterfrom
CupOfTea696:patch-1
Aug 16, 2021
Merged

fix: help command spacing when scriptName is empty#1994
bcoe merged 4 commits intoyargs:masterfrom
CupOfTea696:patch-1

Conversation

@CupOfTea696
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@bcoe bcoe merged commit d33e997 into yargs:master Aug 16, 2021
@CupOfTea696 CupOfTea696 deleted the patch-1 branch November 7, 2021 14:44
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.

2 participants