Skip to content

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

2 participants