@oclif/core 2.8.7 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/parser/parse.js +5 -4
- package/package.json +1 -1
package/lib/parser/parse.js
CHANGED
|
@@ -85,7 +85,7 @@ class Parser {
|
|
|
85
85
|
if (this.flagAliases[char]) {
|
|
86
86
|
return this.flagAliases[char].name;
|
|
87
87
|
}
|
|
88
|
-
return Object.keys(this.input.flags).find(k => this.input.flags[k].char === char);
|
|
88
|
+
return Object.keys(this.input.flags).find(k => (this.input.flags[k].char === char && char !== undefined && this.input.flags[k].char !== undefined));
|
|
89
89
|
};
|
|
90
90
|
const parseFlag = (arg) => {
|
|
91
91
|
const long = arg.startsWith('--');
|
|
@@ -106,11 +106,12 @@ class Parser {
|
|
|
106
106
|
const flag = this.input.flags[name];
|
|
107
107
|
if (flag.type === 'option') {
|
|
108
108
|
this.currentFlag = flag;
|
|
109
|
-
const
|
|
110
|
-
if
|
|
109
|
+
const value = long || arg.length < 3 ? this.argv.shift() : arg.slice(arg[2] === '=' ? 3 : 2);
|
|
110
|
+
// if the value ends up being one of the command's flags, the user didn't provide an input
|
|
111
|
+
if (typeof value !== 'string' || this.input.flags[findLongFlag(value)] || this.input.flags[findShortFlag(value)]) {
|
|
111
112
|
throw new errors_1.CLIError(`Flag --${name} expects a value`);
|
|
112
113
|
}
|
|
113
|
-
this.raw.push({ type: 'flag', flag: flag.name, input });
|
|
114
|
+
this.raw.push({ type: 'flag', flag: flag.name, input: value });
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
116
117
|
this.raw.push({ type: 'flag', flag: flag.name, input: arg });
|