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

Allow options with no short versions #37

Closed
slorber opened this issue Oct 26, 2016 · 4 comments
Closed

Allow options with no short versions #37

slorber opened this issue Oct 26, 2016 · 4 comments

Comments

@slorber
Copy link

slorber commented Oct 26, 2016

Hi,

If there is already a short version with a given letter, I think next options starting with same letter should not expose a short version at all.

Here I'm trying to create a list PR and my --cors options conflits with the --cache option:

    -c, --cache <n>    How long static files should be cached in the browser (seconds)
    -c, --cors <list>  Setup * CORS headers to allow requests from any origin

As far as I understand, I can't setup no short version at all or a short version of more than 1 letter. It means there can't be more than 26 options available and I have to pick a random letter for my cors options

@Siilwyn
Copy link

Siilwyn commented Nov 15, 2016

How about implementing it like this flipping the order:
passed in > resulting flags
'something' > 'something' and 's'
['something'] > 'something'
['something', 'a'] > 'something' and 'a'

The module will check if it's an array, take the first one as the option flag. Then if there is a second element use that for the alias.

@leo
Copy link
Owner

leo commented Dec 8, 2016

I will check if there's already a flag with said short version and then not use a short version, assuming that it's the case.

@leo
Copy link
Owner

leo commented Feb 10, 2017

Released a cool fix!

@DRSDavidSoft
Copy link

Has this behavior been changed?

option(['long'], 'do the thing')       // → Short version of option is longer than 1 char
option(['s', 'long'], 'do the thing')  // → -s, --long
option(['s'], 'do the thing')          // → -s, --undefined
option(['', 'long'], 'do the thing')   // → -, --long
option([null, 'long'], 'do the thing') // → Cannot read property 'length' of null

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

No branches or pull requests

4 participants