@oclif/core 2.7.0 → 2.7.2-beta.1
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 +8 -3
- package/package.json +1 -1
package/lib/parser/parse.js
CHANGED
|
@@ -180,9 +180,14 @@ class Parser {
|
|
|
180
180
|
throw new errors_1.CLIError(`Unexpected flag ${token.flag}`);
|
|
181
181
|
// if flag has defaultHelp, capture its value into metadata
|
|
182
182
|
if (Reflect.has(flag, 'defaultHelp')) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
try {
|
|
184
|
+
const defaultHelpProperty = Reflect.get(flag, 'defaultHelp');
|
|
185
|
+
const defaultHelp = (typeof defaultHelpProperty === 'function' ? await defaultHelpProperty({ options: flag, flags, ...this.context }) : defaultHelpProperty);
|
|
186
|
+
this.metaData.flags[token.flag] = { ...this.metaData.flags[token.flag], defaultHelp };
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// no-op
|
|
190
|
+
}
|
|
186
191
|
}
|
|
187
192
|
if (flag.type === 'boolean') {
|
|
188
193
|
if (token.input === `--no-${flag.name}`) {
|