-
-
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
Extend .argument() to add default value and custom parse for command-argument #1508
Extend .argument() to add default value and custom parse for command-argument #1508
Conversation
@@ -258,6 +258,13 @@ class Help { | |||
*/ | |||
|
|||
argumentDescription(argument) { | |||
const extraInfo = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraInfo
appears to have only 0 or 1 elements.
Does it need to be an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair question. No, does not need to be an array currently. However, I left in the array as planning to add choices, like optionDescription
which I copied the code from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks @abetomo |
InvalidOptionArgumentError was renamed to InvalidArgumentError in tj/commander.js#1508 for commander@8.0.0. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
InvalidOptionArgumentError was renamed to InvalidArgumentError in tj/commander.js#1508 for commander@8.0.0. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
InvalidOptionArgumentError was renamed to InvalidArgumentError in tj/commander.js#1508 for commander@8.0.0. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
InvalidOptionArgumentError was renamed to InvalidArgumentError in tj/commander.js#1508 for commander@8.0.0. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
InvalidOptionArgumentError was renamed to InvalidArgumentError in tj/commander.js#1508 for commander@8.0.0. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
InvalidOptionArgumentError was renamed to InvalidArgumentError in tj/commander.js#1508 for commander@8.0.0. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Pull Request
Problem
Follow through with the idea that
.argument()
follow same pattern as.option()
, with support for default value (for optional arguments) and custom command-argument parsing.Solution
Support for default value (for optional arguments) and custom command-argument parsing.
Implementation notes:
program.args
ChangeLog
InvalidOptionArgumentError
(replaced byInvalidArgumentError
)CommanderError
codecommander.invalidOptionArgument
renamedcommander.invalidArgument