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: show 2 dashes on help for single digit option key or alias #1493

Merged
merged 6 commits into from Dec 2, 2019

Conversation

mleguen
Copy link
Member

@mleguen mleguen commented Nov 27, 2019

To be coherent with what yargs/parser considers as an option single dash key, do not display '-1' but '--1' when '1' is used as an option key or an alias.

See #1454

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 seems reasonable to me, I remembered this legitimate use of --100:

https://node-tap.org/docs/coverage/100/

@bcoe
Copy link
Member

bcoe commented Nov 30, 2019

fixes: #1454

@mleguen mleguen merged commit 63b3dd3 into master Dec 2, 2019
@bcoe bcoe deleted the fix/1454-1-digit-key-or-alias branch December 2, 2019 17:31
@ruyadorno
Copy link
Contributor

@bcoe heads up this changes does not quite fits the example you gave of --100 since it's checking for a single-digit only...

...and unfortunately it breaks the help page for one of my modules that uses the -0 standard, similar to xargs:

XARGS(1)                  BSD General Commands Manual                 XARGS(1)

NAME
     xargs -- construct argument list(s) and execute utility

SYNOPSIS
     xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr] [-L number] [-n number [-x]] [-P maxprocs]
           [-s size] [utility [argument ...]]

DESCRIPTION
     The xargs utility reads space, tab, newline and end-of-file delimited strings from the standard input and exe-
     cutes utility with the strings as arguments.

     [... redacted for brevity]

     The options are as follows:

     -0      Change xargs to expect NUL (``\0'') characters as separators, instead of spaces and newlines.  This is
             expected to be used in concert with the -print0 function in find(1).

@ruyadorno
Copy link
Contributor

I ended up figuring out that yargs-parser itself does not have support to such pattern (which surprises me given its popularity within some of the day-to-day tools I use)

I gave it a try at actually implementing support to it in the parser but not really sure how that will go 😬 yargs/yargs-parser#255 - if it eventually makes its way into the parser then we also should update lib/usage.js to match it

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

3 participants