@oclif/core 2.9.0 → 2.9.2

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.
@@ -257,11 +257,28 @@ class Parser {
257
257
  }
258
258
  return fws;
259
259
  };
260
- const addDefaultHelp = async (fws) => {
260
+ const addDefaultHelp = async (fwsArray) => {
261
261
  const valueReferenceForHelp = fwsArrayToObject(flagsWithAllValues.filter(fws => !fws.metadata?.setFromDefault));
262
- return Promise.all(fws.map(async (fws) => fws.helpFunction ? ({ ...fws, metadata: { ...fws.metadata, defaultHelp: await fws.helpFunction?.(fws, valueReferenceForHelp, this.context) } }) : fws));
262
+ return Promise.all(fwsArray.map(async (fws) => {
263
+ try {
264
+ if (fws.helpFunction) {
265
+ return {
266
+ ...fws,
267
+ metadata: {
268
+ ...fws.metadata,
269
+ defaultHelp: await fws.helpFunction?.(fws, valueReferenceForHelp, this.context),
270
+ },
271
+ };
272
+ }
273
+ }
274
+ catch {
275
+ // no-op
276
+ }
277
+ return fws;
278
+ }));
263
279
  };
264
- const fwsArrayToObject = (fwsArray) => Object.fromEntries(fwsArray.map(fws => [fws.inputFlag.name, fws.value]));
280
+ const fwsArrayToObject = (fwsArray) => Object.fromEntries(fwsArray.filter(fws => fws.value !== undefined)
281
+ .map(fws => [fws.inputFlag.name, fws.value]));
265
282
  const flagTokenMap = this.mapAndValidateFlags();
266
283
  const flagsWithValues = await Promise.all(Object.entries(this.input.flags)
267
284
  // we check them if they have a token, or might have env, default, or defaultHelp. Also include booleans so they get their default value
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.9.0",
4
+ "version": "2.9.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {