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

feat: introduce single-digit boolean aliases #255

Merged

Conversation

ruyadorno
Copy link
Contributor

@ruyadorno ruyadorno commented Mar 7, 2020

Following up from the discussion from: yargs/yargs#1454 even though there are plenty of valid usecases for single-digit aliases and many well stablished examples, it is still completely unsupported on yargs-parser.

As brought up by @benjie many standard unix tools uses such pattern, after reading his examples and giving it some thought, I ended up classifying them in two groups:

  • Single-digit shortcut flags, which behave as booleans modifying behavior within the tool:
    • xargs -0
    • kill -9
    • gzip -1
    • rsync -6
  • Numeric shortcut params, which behave as actual number configs:
    • git log -3
    • grep -3

This changeset introduces the support to the first group described, in which single-digits can be used as alias in the context of boolean flags.

/cc @bcoe @mleguen

As discussed on yargs/yargs#1454
even though there are plenty of valid usecases for single-digit
aliases and many well stablished examples, it is still
completely unsupported on yargs-parser.

This changeset introduces the possibility of using this simple numeric
alias in the context of boolean flags.
Copy link
Member

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this feature looks great to me @ruyadorno thanks for the contribution.

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