var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { findMissingOptions: () => findMissingOptions, partialParse: () => partialParse }); module.exports = __toCommonJS(src_exports); // src/noop.ts var noop = () => { }; // src/index.ts var import_camelcase = __toESM(require("camelcase"), 1); var import_commander = require("commander"); var findMissingOptions = (command, providedOptionsByCommand) => { const missingOptionsByCommand = /* @__PURE__ */ new Map(); let currentCommand = command; while (currentCommand) { const missingOptions = /* @__PURE__ */ new Set(); const providedOptions = providedOptionsByCommand.get(currentCommand); for (const option of currentCommand.options) { const key = option.negate ? (0, import_camelcase.default)(option.long.replace(/^--no-/, "")) : (0, import_camelcase.default)(option.long ?? option.short); if (providedOptions?.[key] !== void 0) { continue; } missingOptions.add(key); } missingOptionsByCommand.set(currentCommand, missingOptions); currentCommand = currentCommand.parent; } return missingOptionsByCommand; }; var copyCommandSettings = (source, target) => { for (const keysToCopy of [ "_allowExcessArguments", "_allowUnknownOption", "_combineFlagAndOptionalValue", "_defaultCommandName", "_enablePositionalOptions", "_passThroughOptions" ]) { target[keysToCopy] = source[keysToCopy]; } target.name(source.name()); target.aliases(source.aliases()); for (const argument of source.registeredArguments) { target.addArgument(argument); } if (source.version()) { target.version( source.version(), source.options.find( (option) => option.attributeName() === source._versionOptionName )?.flags ); } }; var disableCommandOutput = (command) => { command.configureOutput({ writeOut: noop, writeErr: noop, outputError: noop }); }; var cloneOption = (option) => { const newOption = new import_commander.Option(option.flags, option.description); newOption.makeOptionMandatory(false); newOption.default(option.defaultValue, option.defaultValueDescription); newOption.preset(option.presetArg); newOption.env(option.envVar); if (option.parseArg) { newOption.argParser(option.parseArg); } if (option.argChoices) { newOption.choices(option.argChoices); } newOption.conflicts( option.conflictsWith ); newOption.implied = option.implied; return newOption; }; var partialParse = (command, argv, options) => { const providedOptions = /* @__PURE__ */ new Map(); const providedOptionsSources = /* @__PURE__ */ new Map(); const commandsMap = /* @__PURE__ */ new Map(); let matchedCommand; const setProvidedOptionSource = (command2, optionKey, source) => { if (!source) { return; } const sourcesMap = providedOptionsSources.get(command2) ?? /* @__PURE__ */ new Map(); sourcesMap.set(optionKey, source); providedOptionsSources.set(command2, sourcesMap); }; const createParserCommand = (parserCommand2, command2) => { commandsMap.set(parserCommand2, command2); copyCommandSettings(command2, parserCommand2); disableCommandOutput(parserCommand2); parserCommand2.exitOverride(); for (const option of command2.options) { if (parserCommand2.options.some( (parserCommandOption) => parserCommandOption.flags === option.flags )) { continue; } parserCommand2.addOption(cloneOption(option)); } parserCommand2.hook("preSubcommand", (thisCommand, actionCommand) => { for (const cmd of [thisCommand, actionCommand]) { providedOptions.set(commandsMap.get(cmd), cmd.opts()); for (const optionKey of Object.keys(cmd.opts())) { setProvidedOptionSource( cmd, optionKey, cmd.getOptionValueSource(optionKey) ); } } }); parserCommand2.action(() => { providedOptions.set( commandsMap.get(parserCommand2), parserCommand2.opts() ); for (const optionKey of Object.keys(parserCommand2.opts())) { setProvidedOptionSource( commandsMap.get(parserCommand2), optionKey, parserCommand2.getOptionValueSource(optionKey) ); } matchedCommand = command2; }); for (const subcommand of command2.commands) { const parserSubcommand = parserCommand2.command(subcommand.name()); createParserCommand(parserSubcommand, subcommand); } return parserCommand2; }; const parserCommand = createParserCommand(new import_commander.Command(), command); parserCommand.parse(argv, options); const missingOptions = matchedCommand ? findMissingOptions(matchedCommand, providedOptions) : /* @__PURE__ */ new Map(); return { matchedCommand, missingOptions, providedOptions, providedOptionsSources }; }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { findMissingOptions, partialParse }); //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2luZGV4LnRzIiwgIi4uL3NyYy9ub29wLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJpbXBvcnQgeyBub29wIH0gZnJvbSBcIi4vbm9vcC50c1wiO1xuaW1wb3J0IGNhbWVsQ2FzZSBmcm9tIFwiY2FtZWxjYXNlXCI7XG5pbXBvcnQge1xuICB0eXBlIE9wdGlvblZhbHVlcyxcbiAgQ29tbWFuZCxcbiAgdHlwZSBQYXJzZU9wdGlvbnMsXG4gIE9wdGlvbixcbiAgdHlwZSBPcHRpb25WYWx1ZVNvdXJjZSxcbn0gZnJvbSBcImNvbW1hbmRlclwiO1xuXG5leHBvcnQgY29uc3QgZmluZE1pc3NpbmdPcHRpb25zID0gKFxuICBjb21tYW5kOiBDb21tYW5kLFxuICBwcm92aWRlZE9wdGlvbnNCeUNvbW1hbmQ6IE1hcDxDb21tYW5kLCBPcHRpb25WYWx1ZXM+LFxuKSA9PiB7XG4gIGNvbnN0IG1pc3NpbmdPcHRpb25zQnlDb21tYW5kID0gbmV3IE1hcDxDb21tYW5kLCBTZXQ8c3RyaW5nPj4oKTtcblxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L2Jhbi10eXBlc1xuICBsZXQgY3V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5zZXQoY29tbWFuZHNNYXAuZ2V0KGNtZCkhLCBjbWQub3B0cygpKTtcblxuICAgICAgICBmb3IgKGNvbnN0IG9wdGlvbktleSBvZiBPYmplY3Qua2V5cyhjbWQub3B0cygpKSkge1xuICAgICAgICAgIHNldFByb3ZpZGVkT3B0aW9uU291cmNlKFxuICAgICAgICAgICAgY21kLFxuICAgICAgICAgICAgb3B0aW9uS2V5LFxuICAgICAgICAgICAgY21kLmdldE9wdGlvblZhbHVlU291cmNlKG9wdGlvbktleSksXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0pO1xuXG4gICAgcGFyc2VyQ29tbWFuZC5hY3Rpb24oKCkgPT4ge1xuICAgICAgcHJvdmlkZWRPcHRpb25zLnNldChcbiAgICAgICAgY29tbWFuZHNNYXAuZ2V0KHBhcnNlckNvbW1hbmQpISxcbiAgICAgICAgcGFyc2VyQ29tbWFuZC5vcHRzKCksXG4gICAgICApO1xuXG4gICAgICBmb3IgKGNvbnN0IG9wdGlvbktleSBvZiBPYmplY3Qua2V5cyhwYXJzZXJDb21tYW5kLm9wdHMoKSkpIHtcbiAgICAgICAgc2V0UHJvdmlkZWRPcHRpb25Tb3VyY2UoXG4gICAgICAgICAgY29tbWFuZHNNYXAuZ2V0KHBhcnNlckNvbW1hbmQpISxcbiAgICAgICAgICBvcHRpb25LZXksXG4gICAgICAgICAgcGFyc2VyQ29tbWFuZC5nZXRPcHRpb25WYWx1ZVNvdXJjZShvcHRpb25LZXkpLFxuICAgICAgICApO1xuICAgICAgfVxuXG4gICAgICBtYXRjaGVkQ29tbWFuZCA9IGNvbW1hbmQ7XG4gICAgfSk7XG5cbiAgICBmb3IgKGNvbnN0IHN1YmNvbW1hbmQgb2YgY29tbWFuZC5jb21tYW5kcyBhcyBDb21tYW5kW10pIHtcbiAgICAgIGNvbnN0IHBhcnNlclN1YmNvbW1hbmQgPSBwYXJzZXJDb21tYW5kLmNvbW1hbmQoc3ViY29tbWFuZC5uY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