UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

26 lines 922 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const lodash_1 = require("lodash"); const commanderUtil = { mapIncomingToOptions(...args) { const strings = args.filter((a) => typeof a === 'string'); const possibleSchema = args[args.length - 1]; const schema = possibleSchema?.id && possibleSchema?.fields ? possibleSchema : undefined; const originalOptions = args.find((a) => (0, lodash_1.isObjectLike)(a)) ?? {}; const options = {}; if (schema) { const fieldNames = Object.keys(schema.fields ?? {}); for (let c = 0; c < strings.length; c++) { options[fieldNames[c]] = strings[c]; } } return { ...originalOptions, ...options, }; }, }; exports.default = commanderUtil; //# sourceMappingURL=commander.utility.js.map