@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.
@@ -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 input = long || arg.length < 3 ? this.argv.shift() : arg.slice(arg[2] === '=' ? 3 : 2);
110
- if (typeof input !== 'string') {
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 });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "2.8.7",
4
+ "version": "2.8.8",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {