-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
List values, shorthand flag with more than 1 character values #908
Comments
function splitComponents(val) {
return val.split(',');
}
program
.option('-c, --components <components>', 'List of components to create', splitComponents) and call like:
|
See also #913 for some other approaches to options taking lists. |
An answer was provided, and no further activity in a month. Closing this as resolved. Feel free to open a new issue if it comes up again, with new information and renewed interest. |
Thank you, this was great help. Sorry for not posting back and closing. |
I am having some issues, I may just not understand how this works. This is on windows 10.
Lists
Test
index.js --components dir\one dir\two
Expected results:
program.components = ["dir\\one", "dir\\two"]
Actual:
program.components = "dir\\one";
Shorthand flag, more than one character:
index.js --testfolder somefolder
Results
program.testfolder = "somefolder"
index.js -tf somefolder
Results
program.testfolder = undefined
However, with a single char:
index.js -x somefolder
Results
program.testfolder = "somefolder"
The text was updated successfully, but these errors were encountered: