We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50d88de commit 7577e65Copy full SHA for 7577e65
lib/option.js
@@ -24,9 +24,11 @@ class Option {
24
this.long = optionFlags.longFlag;
25
this.strictOptionalHelpTerm = null;
26
if (this.optional) {
27
- const { 0: argument, index } = flags.match(/\[.*\]/);
+ const indexStart = flags.indexOf('[');
28
+ const indexEnd = indexStart + flags.slice(indexStart).indexOf(']') + 1;
29
+ const argument = flags.slice(indexStart, indexEnd);
30
this.strictOptionalHelpTerm = (
- flags.slice(0, index) + flags.slice(index + argument.length)
31
+ flags.slice(0, indexStart) + flags.slice(indexEnd)
32
);
33
if (this.short) {
34
this.strictOptionalHelpTerm = this.strictOptionalHelpTerm
0 commit comments