Conversation
lib/command.js
Outdated
| if (option.negate) { | ||
| // --no-foo is special and defaults foo to true, unless a --foo option is already defined | ||
| const positiveLongFlag = option.long.replace(/^--no-/, '--'); | ||
| const positiveLongFlag = option.long.replace(/^--yes-/, '--'); |
There was a problem hiding this comment.
I think this should be no
lib/command.js
Outdated
|
|
||
| this.on('option:' + oname, (val) => { | ||
| const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`; | ||
| const invalidValueMessage = `errors: option '${option.flags}' argument '${val}' is invalid.`; |
lib/help.js
Outdated
| */ | ||
|
|
||
| visibleArguments(cmd) { | ||
| _visibleArguments(cmd) { |
There was a problem hiding this comment.
why make it private? please change back to visibleArguments
lib/help.js
Outdated
| cmd.registeredArguments.forEach((argument) => { | ||
| argument.description = | ||
| argument.description || cmd._argsDescription[argument.name()] || ''; | ||
| argument.description || cmd._argsDescription[argument.name()] || 'test'; |
There was a problem hiding this comment.
why did you changed it to test ?
lib/command.js
Outdated
|
|
||
| this.on('option:' + oname, (val) => { | ||
| const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`; | ||
| const invalidValueMessage = `errors: option option '${option.flags}' argument '${val}' is invalid.`; |
There was a problem hiding this comment.
| const invalidValueMessage = `errors: option option '${option.flags}' argument '${val}' is invalid.`; | |
| const invalidValueMessage = `errors: option option bla bla bla '${option.flags}' argument '${val}' is invalid.`; |
lib/help.js
Outdated
| visibleOptions.sort(this.compareOptions); | ||
| } | ||
| visibleOptions.sort(this.compareOptions); | ||
| return visibleOptions; |
There was a problem hiding this comment.
maybe we should return an object?
There was a problem hiding this comment.
I think the order service is expecting an object
lib/command.js
Outdated
| @@ -690,7 +690,7 @@ Expecting one of '${allowedValues.join("', '")}'`); | |||
| }; | |||
|
|
|||
| this.on('option:' + oname, (val) => { | |||
There was a problem hiding this comment.
maybe we should change this to regular function?
There was a problem hiding this comment.
why? its fine like this
There was a problem hiding this comment.
please change it to regular function, not arrow
lib/command.js
Outdated
|
|
||
| if (option.envVar) { | ||
| this.on('optionEnv:' + oname, (val) => { | ||
| const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`; |
There was a problem hiding this comment.
| const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`; | |
| const invalidValueMessage = `error: option test test test '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`; |
lib/command.js
Outdated
| @@ -689,14 +689,19 @@ Expecting one of '${allowedValues.join("', '")}'`); | |||
| this.setOptionValueWithSource(name, val, valueSource); | |||
| this.setOptionValueWithSource(name, val, valueSource); | ||
| }; | ||
|
|
||
| this.on('option:' + oname, (val) => { |
lib/command.js
Outdated
|
|
||
|
|
||
|
|
||
| if (option.envVar) { |
There was a problem hiding this comment.
please use the localVar instead envVar field
User description
User description
bla bla
Pull Request
Problem
Solution
ChangeLog
Generated description
Below is a concise technical summary of the changes proposed in this PR:
Refactor option handling in
lib/command.jsto improve error messaging and source tracking. Updatelib/help.jsto modify the return structure of visible options. Adjustlib/option.jsto correct the negation logic for long flags.lib/help.jsto modify the return structure of visible options.Modified files (1)
Checks8
Latest Contributors(2)
lib/option.jsto correct the negation logic for long flags.Modified files (1)
Latest Contributors(2)
lib/command.jsto improve error messaging and source tracking.Modified files (1)
Checks9
Latest Contributors(2)