From f384ecf12663a93444308c775a33576320aabaad Mon Sep 17 00:00:00 2001 From: Wee Bit Date: Thu, 17 Aug 2023 10:41:33 +0200 Subject: [PATCH] Run typings autogeneration for the first time The original, manually written typings are kept in the repo for now because they still have to be moved to JSDoc which currently differs from them in a lot of places. --- typings/argument.d.ts | 68 +++ typings/argument.d.ts.map | 1 + typings/command.d.ts | 845 ++++++++++++++++++++++++++++++++ typings/command.d.ts.map | 1 + typings/error.d.ts | 30 ++ typings/error.d.ts.map | 1 + typings/exports/esm.d.mts | 188 +++++++ typings/exports/esm.d.mts.map | 1 + typings/exports/index.d.ts | 184 +++++++ typings/exports/index.d.ts.map | 1 + typings/help.d.ts | 182 +++++++ typings/help.d.ts.map | 1 + typings/option.d.ts | 180 +++++++ typings/option.d.ts.map | 1 + typings/suggestSimilar.d.ts | 9 + typings/suggestSimilar.d.ts.map | 1 + 16 files changed, 1694 insertions(+) create mode 100644 typings/argument.d.ts create mode 100644 typings/argument.d.ts.map create mode 100644 typings/command.d.ts create mode 100644 typings/command.d.ts.map create mode 100644 typings/error.d.ts create mode 100644 typings/error.d.ts.map create mode 100644 typings/exports/esm.d.mts create mode 100644 typings/exports/esm.d.mts.map create mode 100644 typings/exports/index.d.ts create mode 100644 typings/exports/index.d.ts.map create mode 100644 typings/help.d.ts create mode 100644 typings/help.d.ts.map create mode 100644 typings/option.d.ts create mode 100644 typings/option.d.ts.map create mode 100644 typings/suggestSimilar.d.ts create mode 100644 typings/suggestSimilar.d.ts.map diff --git a/typings/argument.d.ts b/typings/argument.d.ts new file mode 100644 index 000000000..e673efacd --- /dev/null +++ b/typings/argument.d.ts @@ -0,0 +1,68 @@ +export class Argument { + /** + * Initialize a new command argument with the given name and description. + * The default is that the argument is required, and you can explicitly + * indicate this with <> around the name. Put [] around the name for an optional argument. + * + * @param {string} name + * @param {string} [description] + */ + constructor(name: string, description?: string | undefined); + description: string; + variadic: boolean; + parseArg: Function | ((arg: any, previous: any) => any) | undefined; + defaultValue: any; + defaultValueDescription: string | undefined; + argChoices: string[] | undefined; + required: boolean; + _name: string; + /** + * Return argument name. + * + * @return {string} + */ + name(): string; + /** + * @package + */ + _concatValue(value: any, previous: any): any[]; + /** + * Set the default value, and optionally supply the description to be displayed in the help. + * + * @param {any} value + * @param {string} [description] + * @return {Argument} + */ + default(value: any, description?: string | undefined): Argument; + /** + * Set the custom handler for processing CLI command arguments into argument values. + * + * @param {Function} [fn] + * @return {Argument} + */ + argParser(fn?: Function | undefined): Argument; + /** + * Only allow argument value to be one of choices. + * + * @param {string[]} values + * @return {Argument} + */ + choices(values: string[]): Argument; + /** + * Make argument required. + */ + argRequired(): Argument; + /** + * Make argument optional. + */ + argOptional(): Argument; +} +/** + * Takes an argument and returns its human readable equivalent for help usage. + * + * @param {Argument} arg + * @return {string} + * @package + */ +export function humanReadableArgName(arg: Argument): string; +//# sourceMappingURL=argument.d.ts.map \ No newline at end of file diff --git a/typings/argument.d.ts.map b/typings/argument.d.ts.map new file mode 100644 index 000000000..9b94788a5 --- /dev/null +++ b/typings/argument.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../lib/argument.js"],"names":[],"mappings":"AAEA;IACE;;;;;;;OAOG;IAEH,kBAJW,MAAM,oCA+BhB;IA1BC,oBAAoC;IACpC,kBAAqB;IACrB,oEAAyB;IACzB,kBAA6B;IAC7B,4CAAwC;IACxC,iCAA2B;IAIvB,kBAAoB;IACpB,cAA8B;IAkBpC;;;;OAIG;IAEH,QAHY,MAAM,CAKjB;IAED;;OAEG;IAEH,+CAMC;IAED;;;;;;OAMG;IAEH,eALW,GAAG,qCAEF,QAAQ,CAOnB;IAED;;;;;OAKG;IAEH,sCAHY,QAAQ,CAMnB;IAED;;;;;OAKG;IAEH,gBAJW,MAAM,EAAE,GACP,QAAQ,CAgBnB;IAED;;OAEG;IACH,wBAGC;IAED;;OAEG;IACH,wBAGC;CACF;AAED;;;;;;GAMG;AAEH,0CALW,QAAQ,GACP,MAAM,CAUjB"} \ No newline at end of file diff --git a/typings/command.d.ts b/typings/command.d.ts new file mode 100644 index 000000000..79e277b22 --- /dev/null +++ b/typings/command.d.ts @@ -0,0 +1,845 @@ +/// +export class Command extends EventEmitter { + /** + * Initialize a new `Command`. + * + * @param {string} [name] + */ + constructor(name?: string | undefined); + /** @type {Command[]} */ + commands: Command[]; + /** @type {Option[]} */ + options: Option[]; + parent: any; + _allowUnknownOption: boolean; + _allowExcessArguments: boolean; + /** @type {Argument[]} */ + _args: Argument[]; + /** @type {string[]} */ + args: string[]; + rawArgs: any[]; + processedArgs: any[]; + _scriptPath: any; + _name: string; + _optionValues: {}; + _optionValueSources: {}; + _storeOptionsAsProperties: boolean; + _actionHandler: ((args: any) => any) | null; + _executableHandler: boolean; + _executableFile: any; + _executableDir: string | null; + _defaultCommandName: string | null; + _exitCallback: any; + _aliases: any[]; + _combineFlagAndOptionalValue: boolean; + _description: string; + _summary: string; + _argsDescription: any; + _enablePositionalOptions: boolean; + _passThroughOptions: boolean; + _lifeCycleHooks: {}; + /** @type {boolean | string} */ + _showHelpAfterError: boolean | string; + _showSuggestionAfterError: boolean; + _outputConfiguration: { + writeOut: (str: any) => boolean; + writeErr: (str: any) => boolean; + getOutHelpWidth: () => number | undefined; + getErrHelpWidth: () => number | undefined; + outputError: (str: any, write: any) => any; + }; + _hidden: boolean; + _hasHelpOption: boolean; + _helpFlags: string; + _helpDescription: string; + _helpShortFlag: string; + _helpLongFlag: string; + _addImplicitHelpCommand: boolean | undefined; + _helpCommandName: string; + _helpCommandnameAndArgs: string; + _helpCommandDescription: string; + _helpConfiguration: {}; + /** + * Copy settings that are useful to have in common across root command and subcommands. + * + * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.) + * + * @param {Command} sourceCommand + * @return {Command} `this` command for chaining + */ + copyInheritedSettings(sourceCommand: Command): Command; + /** + * Define a command. + * + * There are two styles of command: pay attention to where to put the description. + * + * @example + * // Command implemented using action handler (description is supplied separately to `.command`) + * program + * .command('clone [destination]') + * .description('clone a repository into a newly created directory') + * .action((source, destination) => { + * console.log('clone command called'); + * }); + * + * // Command implemented using separate executable file (description is second parameter to `.command`) + * program + * .command('start ', 'start named service') + * .command('stop [service]', 'stop named service, or all if no name supplied'); + * + * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` + * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {Object} [execOpts] - configuration options (for executable) + * @return {Command} returns new command for action handler, or `this` for executable command + */ + command(nameAndArgs: string, actionOptsOrExecDesc?: any | string, execOpts?: any): Command; + /** + * Factory routine to create a new unattached command. + * + * See .command() for creating an attached subcommand, which uses this routine to + * create the command. You can override createCommand to customise subcommands. + * + * @param {string} [name] + * @return {Command} new command + */ + createCommand(name?: string | undefined): Command; + /** + * You can customise the help with a subclass of Help by overriding createHelp, + * or by overriding Help properties using configureHelp(). + * + * @return {Help} + */ + createHelp(): Help; + /** + * You can customise the help by overriding Help properties using configureHelp(), + * or with a subclass of Help by overriding createHelp(). + * + * @param {Object} [configuration] - configuration options + * @return {Command|Object} `this` command for chaining, or stored configuration + */ + configureHelp(configuration?: any): Command | any; + /** + * The default output goes to stdout and stderr. You can customise this for special + * applications. You can also customise the display of errors by overriding outputError. + * + * The configuration properties are all functions: + * + * // functions to change where being written, stdout and stderr + * writeOut(str) + * writeErr(str) + * // matching functions to specify width for wrapping help + * getOutHelpWidth() + * getErrHelpWidth() + * // functions based on what is being written out + * outputError(str, write) // used for displaying errors, and not used for displaying help + * + * @param {Object} [configuration] - configuration options + * @return {Command|Object} `this` command for chaining, or stored configuration + */ + configureOutput(configuration?: any): Command | any; + /** + * Display the help or a custom message after an error occurs. + * + * @param {boolean|string} [displayHelp] + * @return {Command} `this` command for chaining + */ + showHelpAfterError(displayHelp?: string | boolean | undefined): Command; + /** + * Display suggestion of similar commands for unknown commands, or options for unknown options. + * + * @param {boolean} [displaySuggestion] + * @return {Command} `this` command for chaining + */ + showSuggestionAfterError(displaySuggestion?: boolean | undefined): Command; + /** + * Add a prepared subcommand. + * + * See .command() for creating an attached subcommand which inherits settings from its parent. + * + * @param {Command} cmd - new subcommand + * @param {Object} [opts] - configuration options + * @return {Command} `this` command for chaining + */ + addCommand(cmd: Command, opts?: any): Command; + /** + * Factory routine to create a new unattached argument. + * + * See .argument() for creating an attached argument, which uses this routine to + * create the argument. You can override createArgument to return a custom argument. + * + * @param {string} name + * @param {string} [description] + * @return {Argument} new argument + */ + createArgument(name: string, description?: string | undefined): Argument; + /** + * Define argument syntax for command. + * + * The default is that the argument is required, and you can explicitly + * indicate this with <> around the name. Put [] around the name for an optional argument. + * + * @example + * program.argument(''); + * program.argument('[output-file]'); + * + * @param {string} name + * @param {string} [description] + * @param {Function|*} [fn] - custom argument processing function + * @param {*} [defaultValue] + * @return {Command} `this` command for chaining + */ + argument(name: string, description?: string | undefined, fn?: Function | any, defaultValue?: any): Command; + /** + * Define argument syntax for command, adding multiple at once (without descriptions). + * + * See also .argument(). + * + * @example + * program.arguments(' [env]'); + * + * @param {string} names + * @return {Command} `this` command for chaining + */ + arguments(names: string): Command; + /** + * Define argument syntax for command, adding a prepared argument. + * + * @param {Argument} argument + * @return {Command} `this` command for chaining + */ + addArgument(argument: Argument): Command; + /** + * Override default decision whether to add implicit help command. + * + * addHelpCommand() // force on + * addHelpCommand(false); // force off + * addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details + * + * @return {Command} `this` command for chaining + */ + addHelpCommand(enableOrNameAndArgs: any, description: any): Command; + /** + * @return {boolean} + * @package + */ + _hasImplicitHelpCommand(): boolean; + /** + * Add hook for life cycle event. + * + * @param {string} event + * @param {Function} listener + * @return {Command} `this` command for chaining + */ + hook(event: string, listener: Function): Command; + /** + * Register callback to use as replacement for calling process.exit. + * + * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing + * @return {Command} `this` command for chaining + */ + exitOverride(fn?: Function | undefined): Command; + /** + * Call process.exit, and _exitCallback if defined. + * + * @param {number} exitCode exit code for using with process.exit + * @param {string} code an id string representing the error + * @param {string} message human-readable description of the error + * @return never + * @package + */ + _exit(exitCode: number, code: string, message: string): void; + /** + * Register callback `fn` for the command. + * + * @example + * program + * .command('serve') + * .description('start service') + * .action(function() { + * // do work here + * }); + * + * @param {Function} fn + * @return {Command} `this` command for chaining + */ + action(fn: Function): Command; + /** + * Factory routine to create a new unattached option. + * + * See .option() for creating an attached option, which uses this routine to + * create the option. You can override createOption to return a custom option. + * + * @param {string} flags + * @param {string} [description] + * @return {Option} new option + */ + createOption(flags: string, description?: string | undefined): Option; + /** + * Add an option. + * + * @param {Option} option + * @return {Command} `this` command for chaining + */ + addOption(option: Option): Command; + /** + * Internal implementation shared by .option() and .requiredOption() + * + * @package + */ + _optionEx(config: any, flags: any, description: any, fn: any, defaultValue: any): Command; + /** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string contains the short and/or long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * @example + * // simple boolean defaulting to undefined + * program.option('-p, --pepper', 'add pepper'); + * + * program.pepper + * // => undefined + * + * --pepper + * program.pepper + * // => true + * + * // simple boolean defaulting to true (unless non-negated option is also defined) + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {string} flags + * @param {string} [description] + * @param {Function|*} [fn] - custom option processing function or default value + * @param {*} [defaultValue] + * @return {Command} `this` command for chaining + */ + option(flags: string, description?: string | undefined, fn?: Function | any, defaultValue?: any): Command; + /** + * Add a required option which must have a value after parsing. This usually means + * the option must be specified on the command line. (Otherwise the same as .option().) + * + * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. + * + * @param {string} flags + * @param {string} [description] + * @param {Function|*} [fn] - custom option processing function or default value + * @param {*} [defaultValue] + * @return {Command} `this` command for chaining + */ + requiredOption(flags: string, description?: string | undefined, fn?: Function | any, defaultValue?: any): Command; + /** + * Alter parsing of short flags with optional values. + * + * @example + * // for `.option('-f,--flag [value]'): + * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour + * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b` + * + * @param {Boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. + */ + combineFlagAndOptionalValue(combine?: boolean | undefined): Command; + /** + * Allow unknown options on the command line. + * + * @param {Boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown + * for unknown options. + */ + allowUnknownOption(allowUnknown?: boolean | undefined): Command; + /** + * Allow excess command-arguments on the command line. Pass false to make excess arguments an error. + * + * @param {Boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown + * for excess arguments. + */ + allowExcessArguments(allowExcess?: boolean | undefined): Command; + /** + * Enable positional options. Positional means global options are specified before subcommands which lets + * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions. + * The default behaviour is non-positional and global options may appear anywhere on the command line. + * + * @param {Boolean} [positional=true] + */ + enablePositionalOptions(positional?: boolean | undefined): Command; + /** + * Pass through options that come after command-arguments rather than treat them as command-options, + * so actual command-options come before command-arguments. Turning this on for a subcommand requires + * positional options to have been enabled on the program (parent commands). + * The default behaviour is non-positional and options may appear before or after command-arguments. + * + * @param {Boolean} [passThrough=true] + * for unknown options. + */ + passThroughOptions(passThrough?: boolean | undefined): Command; + /** + * Whether to store option values as properties on command object, + * or store separately (specify false). In both cases the option values can be accessed using .opts(). + * + * @param {boolean} [storeAsProperties=true] + * @return {Command} `this` command for chaining + */ + storeOptionsAsProperties(storeAsProperties?: boolean | undefined): Command; + /** + * Retrieve option value. + * + * @param {string} key + * @return {Object} value + */ + getOptionValue(key: string): any; + /** + * Store option value. + * + * @param {string} key + * @param {Object} value + * @return {Command} `this` command for chaining + */ + setOptionValue(key: string, value: any): Command; + /** + * Store option value and where the value came from. + * + * @param {string} key + * @param {Object} value + * @param {string} [source] - expected values are default/config/env/cli/implied + * @return {Command} `this` command for chaining + */ + setOptionValueWithSource(key: string, value: any, source?: string | undefined): Command; + /** + * Get source of option value. + * Expected values are default | config | env | cli | implied + * + * @param {string} key + * @return {string | undefined} + */ + getOptionValueSource(key: string): string | undefined; + /** + * Get source of option value. See also .optsWithGlobals(). + * Expected values are default | config | env | cli | implied + * + * @param {string} key + * @return {string | undefined} + */ + getOptionValueSourceWithGlobals(key: string): string | undefined; + /** + * Get user arguments from implied or explicit arguments. + * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches. + * + * @package + */ + _prepareUserArgs(argv: any, parseOptions: any): any; + /** + * Parse `argv`, setting options and invoking commands when defined. + * + * The default expectation is that the arguments are from node and have the application as argv[0] + * and the script being run in argv[1], with user parameters after that. + * + * @example + * program.parse(process.argv); + * program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions + * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0] + * + * @param {string[]} [argv] - optional, defaults to process.argv + * @param {Object} [parseOptions] - optionally specify style of options with from: node/user/electron + * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron' + * @return {Command} `this` command for chaining + */ + parse(argv?: string[] | undefined, parseOptions?: { + from?: string | undefined; + } | undefined): Command; + /** + * Parse `argv`, setting options and invoking commands when defined. + * + * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise. + * + * The default expectation is that the arguments are from node and have the application as argv[0] + * and the script being run in argv[1], with user parameters after that. + * + * @example + * await program.parseAsync(process.argv); + * await program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions + * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0] + * + * @param {string[]} [argv] + * @param {Object} [parseOptions] + * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron' + * @return {Promise} + */ + parseAsync(argv?: string[] | undefined, parseOptions?: { + from: string; + } | undefined): Promise; + /** + * Execute a sub-command executable. + * + * @package + */ + _executeSubCommand(subcommand: any, args: any): void; + runningCommand: childProcess.ChildProcess | undefined; + /** + * @package + */ + _dispatchSubcommand(commandName: any, operands: any, unknown: any): void | Promise; + /** + * Invoke help directly if possible, or dispatch if necessary. + * e.g. help foo + * + * @package + */ + _dispatchHelpCommand(subcommandName: any): void | Promise; + /** + * Check this.args against expected this._args. + * + * @package + */ + _checkNumberOfArguments(): void; + /** + * Process this.args using this._args and save as this.processedArgs! + * + * @package + */ + _processArguments(): void; + /** + * Once we have a promise we chain, but call synchronously until then. + * + * @param {Promise|undefined} promise + * @param {Function} fn + * @return {Promise|undefined} + * @package + */ + _chainOrCall(promise: Promise | undefined, fn: Function): Promise | undefined; + /** + * + * @param {Promise|undefined} promise + * @param {string} event + * @return {Promise|undefined} + * @package + */ + _chainOrCallHooks(promise: Promise | undefined, event: string): Promise | undefined; + /** + * + * @param {Promise|undefined} promise + * @param {Command} subCommand + * @param {string} event + * @return {Promise|undefined} + * @package + */ + _chainOrCallSubCommandHook(promise: Promise | undefined, subCommand: Command, event: string): Promise | undefined; + /** + * Process arguments in context of this command. + * Returns action result, in case it is a promise. + * + * @package + */ + _parseCommand(operands: any, unknown: any): void | Promise; + /** + * Find matching command. + * + * @package + */ + _findCommand(name: any): Command | undefined; + /** + * Return an option matching `arg` if any. + * + * @param {string} arg + * @return {Option | undefined} + * @package + */ + _findOption(arg: string): Option | undefined; + /** + * Display an error message if a mandatory option does not have a value. + * Called after checking for help flags in leaf subcommand. + * + * @package + */ + _checkForMissingMandatoryOptions(): void; + /** + * Display an error message if conflicting options are used together in this. + * + * @package + */ + _checkForConflictingLocalOptions(): void; + /** + * Display an error message if conflicting options are used together. + * Called after checking for help flags in leaf subcommand. + * + * @package + */ + _checkForConflictingOptions(): void; + /** + * Parse options from `argv` removing known options, + * and return argv split into operands and unknown arguments. + * + * Examples: + * + * argv => operands, unknown + * --known kkk op => [op], [] + * op --known kkk => [op], [] + * sub --unknown uuu op => [sub], [--unknown uuu op] + * sub -- --unknown uuu op => [sub --unknown uuu op], [] + * + * @param {String[]} argv + * @return {{operands: String[], unknown: String[]}} + */ + parseOptions(argv: string[]): { + operands: string[]; + unknown: string[]; + }; + /** + * Return an object containing local option values as key-value pairs. + * + * @return {Object} + */ + opts(): any; + /** + * Return an object containing merged local and global option values as key-value pairs. + * + * @return {Object} + */ + optsWithGlobals(): any; + /** + * Display error message and exit (or call exitOverride). + * + * @param {string} message + * @param {Object} [errorOptions] + * @param {string} [errorOptions.code] - an id string representing the error + * @param {number} [errorOptions.exitCode] - used with process.exit + */ + error(message: string, errorOptions?: { + code?: string | undefined; + exitCode?: number | undefined; + } | undefined): void; + /** + * Apply any option related environment variables, if option does + * not have a value from cli or client code. + * + * @package + */ + _parseOptionsEnv(): void; + /** + * Apply any implied option values, if option is undefined or default value. + * + * @package + */ + _parseOptionsImplied(): void; + /** + * Argument `name` is missing. + * + * @param {string} name + * @package + */ + missingArgument(name: string): void; + /** + * `Option` is missing an argument. + * + * @param {Option} option + * @package + */ + optionMissingArgument(option: Option): void; + /** + * `Option` does not have a value, and is a mandatory option. + * + * @param {Option} option + * @package + */ + missingMandatoryOptionValue(option: Option): void; + /** + * `Option` conflicts with another option. + * + * @param {Option} option + * @param {Option} conflictingOption + * @package + */ + _conflictingOption(option: Option, conflictingOption: Option): void; + /** + * Unknown option `flag`. + * + * @param {string} flag + * @package + */ + unknownOption(flag: string): void; + /** + * Excess arguments, more than expected. + * + * @param {string[]} receivedArgs + * @package + */ + _excessArguments(receivedArgs: string[]): void; + /** + * Unknown command. + * + * @package + */ + unknownCommand(): void; + /** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * You can optionally supply the flags and description to override the defaults. + * + * @param {string} str + * @param {string} [flags] + * @param {string} [description] + * @return {this | string | undefined} `this` command for chaining, or version string if no arguments + */ + version(str: string, flags?: string | undefined, description?: string | undefined): string | Command | undefined; + _version: string | undefined; + _versionOptionName: string | undefined; + /** + * Set the description. + * + * @param {string} [str] + * @param {Object} [argsDescription] + * @return {string|Command} + */ + description(str?: string | undefined, argsDescription?: any): string | Command; + /** + * Set the summary. Used when listed as subcommand of parent. + * + * @param {string} [str] + * @return {string|Command} + */ + summary(str?: string | undefined): string | Command; + /** + * Set an alias for the command. + * + * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help. + * + * @param {string} [alias] + * @return {string|Command} + */ + alias(alias?: string | undefined): string | Command; + /** + * Set aliases for the command. + * + * Only the first alias is shown in the auto-generated help. + * + * @param {string[]} [aliases] + * @return {string[]|Command} + */ + aliases(aliases?: string[] | undefined): string[] | Command; + /** + * Set / get the command usage `str`. + * + * @param {string} [str] + * @return {String|Command} + */ + usage(str?: string | undefined): string | Command; + _usage: string | undefined; + /** + * Get or set the name of the command. + * + * @param {string} [str] + * @return {string|Command} + */ + name(str?: string | undefined): string | Command; + /** + * Set the name of the command from script filename, such as process.argv[1], + * or require.main.filename, or __filename. + * + * (Used internally and public although not documented in README.) + * + * @example + * program.nameFromFilename(require.main.filename); + * + * @param {string} filename + * @return {Command} + */ + nameFromFilename(filename: string): Command; + /** + * Get or set the directory for searching for executable subcommands of this command. + * + * @example + * program.executableDir(__dirname); + * // or + * program.executableDir('subcommands'); + * + * @param {string} [path] + * @return {string|null|Command} + */ + executableDir(path?: string | undefined): string | null | Command; + /** + * Return program help documentation. + * + * @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout + * @return {string} + */ + helpInformation(contextOptions?: { + error: boolean; + } | undefined): string; + /** + * @package + */ + _getHelpContext(contextOptions: any): { + error: boolean; + }; + /** + * Output help information for this command. + * + * Outputs built-in help, and custom text added using `.addHelpText()`. + * + * @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout + */ + outputHelp(contextOptions?: Function | { + error: boolean; + } | undefined): void; + /** + * You can pass in flags and a description to override the help + * flags and help description for your command. Pass in false to + * disable the built-in help option. + * + * @param {string | boolean} [flags] + * @param {string} [description] + * @return {Command} `this` command for chaining + */ + helpOption(flags?: string | boolean | undefined, description?: string | undefined): Command; + /** + * Output help information and exit. + * + * Outputs built-in help, and custom text added using `.addHelpText()`. + * + * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout + */ + help(contextOptions?: { + error: boolean; + } | undefined): void; + /** + * Add additional text to be displayed with the built-in help. + * + * Position is 'before' or 'after' to affect just this command, + * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands. + * + * @param {string} position - before or after built-in help + * @param {string | Function} text - string to add, or a function returning a string + * @return {Command} `this` command for chaining + */ + addHelpText(position: string, text: string | Function): Command; +} +import EventEmitter_1 = require("events"); +import EventEmitter = EventEmitter_1.EventEmitter; +import { Option } from "./option.js"; +import { Argument } from "./argument.js"; +import { Help } from "./help.js"; +import childProcess = require("child_process"); +//# sourceMappingURL=command.d.ts.map \ No newline at end of file diff --git a/typings/command.d.ts.map b/typings/command.d.ts.map new file mode 100644 index 000000000..13862d002 --- /dev/null +++ b/typings/command.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../lib/command.js"],"names":[],"mappings":";AAYA;IACE;;;;OAIG;IAEH,uCA0DC;IAxDC,wBAAwB;IACxB,UADW,OAAO,EAAE,CACF;IAClB,uBAAuB;IACvB,SADW,MAAM,EAAE,CACF;IACjB,YAAkB;IAClB,6BAAgC;IAChC,+BAAiC;IACjC,yBAAyB;IACzB,OADW,QAAQ,EAAE,CACN;IACf,uBAAuB;IACvB,MADW,MAAM,EAAE,CACL;IACd,eAAiB;IACjB,qBAAuB;IACvB,iBAAuB;IACvB,cAAuB;IACvB,kBAAuB;IACvB,wBAA6B;IAC7B,mCAAsC;IACtC,4CAA0B;IAC1B,4BAA+B;IAC/B,qBAA2B;IAC3B,8BAA0B;IAC1B,mCAA+B;IAC/B,mBAAyB;IACzB,gBAAkB;IAClB,sC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AAM,GAAC,OAAO,CAiBzB;IAED;;;;;;;OAOG;IAEH,yCAHY,MAAM,EAAE,GAAC,OAAO,CAS3B;IAED;;;;;OAKG;IAEH,iCAHY,SAAO,OAAO,CAmBzB;IAFC,2BAAiB;IAInB;;;;;OAKG;IAEH,gCAHY,MAAM,GAAC,OAAO,CAOzB;IAED;;;;;;;;;;;OAWG;IAEH,2BAJW,MAAM,GACL,OAAO,CAOlB;IAED;;;;;;;;;;OAUG;IAEH,0CAHY,MAAM,GAAC,IAAI,GAAC,OAAO,CAO9B;IAED;;;;;OAKG;IAEH;eAJoB,OAAO;oBACf,MAAM,CASjB;IAED;;OAEG;IAEH;;MAYC;IAED;;;;;;OAMG;IAEH;eAHoB,OAAO;yBA0B1B;IAED;;;;;;;;OAQG;IAEH,oFAHY,OAAO,CAgBlB;IAED;;;;;;OAMG;IAEH;eAHoB,OAAO;yBAW1B;IAED;;;;;;;;;OASG;IACH,sBAJW,MAAM,QACN,MAAM,WAAW,GAChB,OAAO,CAsBlB;CACF;;qCAjlEsC,YAAY"} \ No newline at end of file diff --git a/typings/error.d.ts b/typings/error.d.ts new file mode 100644 index 000000000..7f00604b5 --- /dev/null +++ b/typings/error.d.ts @@ -0,0 +1,30 @@ +/** + * CommanderError class + * @class + */ +export class CommanderError extends Error { + /** + * Constructs the CommanderError class + * @param {number} exitCode suggested exit code which could be used with process.exit + * @param {string} code an id string representing the error + * @param {string} [message] human-readable description of the error + * @constructor + */ + constructor(exitCode: number, code: string, message?: string | undefined); + code: string; + exitCode: number; + nestedError: any; +} +/** + * InvalidArgumentError class + * @class + */ +export class InvalidArgumentError extends CommanderError { + /** + * Constructs the InvalidArgumentError class + * @param {string} [message] explanation of why argument is invalid + * @constructor + */ + constructor(message?: string | undefined); +} +//# sourceMappingURL=error.d.ts.map \ No newline at end of file diff --git a/typings/error.d.ts.map b/typings/error.d.ts.map new file mode 100644 index 000000000..a3e0e2489 --- /dev/null +++ b/typings/error.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../lib/error.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACE;;;;;;OAMG;IACH,sBALW,MAAM,QACN,MAAM,gCAYhB;IAHC,aAAgB;IAChB,iBAAwB;IACxB,iBAA4B;CAE/B;AAED;;;GAGG;AACH;IACE;;;;OAIG;IACH,0CAKC;CACF"} \ No newline at end of file diff --git a/typings/exports/esm.d.mts b/typings/exports/esm.d.mts new file mode 100644 index 000000000..159bf2714 --- /dev/null +++ b/typings/exports/esm.d.mts @@ -0,0 +1,188 @@ +/// +export const program: { + program: any; + Command: typeof commander.Command; + Argument: typeof commander.Argument; + Option: typeof commander.Option; + Help: typeof commander.Help; + CommanderError: typeof commander.CommanderError; + InvalidArgumentError: typeof commander.InvalidArgumentError; + InvalidOptionArgumentError: typeof commander.InvalidArgumentError; + commands: commander.Command[]; + options: commander.Option[]; + parent: any; + _allowUnknownOption: boolean; + _allowExcessArguments: boolean; + _args: commander.Argument[]; + args: string[]; + rawArgs: any[]; + processedArgs: any[]; + _scriptPath: any; + _name: string; + _optionValues: {}; + _optionValueSources: {}; + _storeOptionsAsProperties: boolean; + _actionHandler: ((args: any) => any) | null; + _executableHandler: boolean; + _executableFile: any; + _executableDir: string | null; + _defaultCommandName: string | null; + _exitCallback: any; + _aliases: any[]; + _combineFlagAndOptionalValue: boolean; + _description: string; + _summary: string; + _argsDescription: any; + _enablePositionalOptions: boolean; + _passThroughOptions: boolean; + _lifeCycleHooks: {}; + _showHelpAfterError: string | boolean; + _showSuggestionAfterError: boolean; + _outputConfiguration: { + writeOut: (str: any) => boolean; + writeErr: (str: any) => boolean; + getOutHelpWidth: () => number | undefined; + getErrHelpWidth: () => number | undefined; + outputError: (str: any, write: any) => any; + }; + _hidden: boolean; + _hasHelpOption: boolean; + _helpFlags: string; + _helpDescription: string; + _helpShortFlag: string; + _helpLongFlag: string; + _addImplicitHelpCommand: boolean | undefined; + _helpCommandName: string; + _helpCommandnameAndArgs: string; + _helpCommandDescription: string; + _helpConfiguration: {}; + copyInheritedSettings(sourceCommand: commander.Command): commander.Command; + command(nameAndArgs: string, actionOptsOrExecDesc?: any, execOpts?: any): commander.Command; + createCommand(name?: string | undefined): commander.Command; + createHelp(): commander.Help; + configureHelp(configuration?: any): any; + configureOutput(configuration?: any): any; + showHelpAfterError(displayHelp?: string | boolean | undefined): commander.Command; + showSuggestionAfterError(displaySuggestion?: boolean | undefined): commander.Command; + addCommand(cmd: commander.Command, opts?: any): commander.Command; + createArgument(name: string, description?: string | undefined): commander.Argument; + argument(name: string, description?: string | undefined, fn?: any, defaultValue?: any): commander.Command; + arguments(names: string): commander.Command; + addArgument(argument: commander.Argument): commander.Command; + addHelpCommand(enableOrNameAndArgs: any, description: any): commander.Command; + _hasImplicitHelpCommand(): boolean; + hook(event: string, listener: Function): commander.Command; + exitOverride(fn?: Function | undefined): commander.Command; + _exit(exitCode: number, code: string, message: string): void; + action(fn: Function): commander.Command; + createOption(flags: string, description?: string | undefined): commander.Option; + addOption(option: commander.Option): commander.Command; + _optionEx(config: any, flags: any, description: any, fn: any, defaultValue: any): commander.Command; + option(flags: string, description?: string | undefined, fn?: any, defaultValue?: any): commander.Command; + requiredOption(flags: string, description?: string | undefined, fn?: any, defaultValue?: any): commander.Command; + combineFlagAndOptionalValue(combine?: boolean | undefined): any; + allowUnknownOption(allowUnknown?: boolean | undefined): any; + allowExcessArguments(allowExcess?: boolean | undefined): any; + enablePositionalOptions(positional?: boolean | undefined): any; + passThroughOptions(passThrough?: boolean | undefined): any; + storeOptionsAsProperties(storeAsProperties?: boolean | undefined): commander.Command; + getOptionValue(key: string): any; + setOptionValue(key: string, value: any): commander.Command; + setOptionValueWithSource(key: string, value: any, source?: string | undefined): commander.Command; + getOptionValueSource(key: string): string | undefined; + getOptionValueSourceWithGlobals(key: string): string | undefined; + _prepareUserArgs(argv: any, parseOptions: any): any; + parse(argv?: string[] | undefined, parseOptions?: { + from?: string | undefined; + } | undefined): commander.Command; + parseAsync(argv?: string[] | undefined, parseOptions?: { + from: string; + } | undefined): Promise; + _executeSubCommand(subcommand: any, args: any): void; + runningCommand: import("child_process").ChildProcess | undefined; + _dispatchSubcommand(commandName: any, operands: any, unknown: any): void | Promise; + _dispatchHelpCommand(subcommandName: any): void | Promise; + _checkNumberOfArguments(): void; + _processArguments(): void; + _chainOrCall(promise: Promise | undefined, fn: Function): Promise | undefined; + _chainOrCallHooks(promise: Promise | undefined, event: string): Promise | undefined; + _chainOrCallSubCommandHook(promise: Promise | undefined, subCommand: commander.Command, event: string): Promise | undefined; + _parseCommand(operands: any, unknown: any): void | Promise; + _findCommand(name: any): commander.Command | undefined; + _findOption(arg: string): commander.Option | undefined; + _checkForMissingMandatoryOptions(): void; + _checkForConflictingLocalOptions(): void; + _checkForConflictingOptions(): void; + parseOptions(argv: string[]): { + operands: string[]; + unknown: string[]; + }; + opts(): any; + optsWithGlobals(): any; + error(message: string, errorOptions?: { + code?: string | undefined; + exitCode?: number | undefined; + } | undefined): void; + _parseOptionsEnv(): void; + _parseOptionsImplied(): void; + missingArgument(name: string): void; + optionMissingArgument(option: commander.Option): void; + missingMandatoryOptionValue(option: commander.Option): void; + _conflictingOption(option: commander.Option, conflictingOption: commander.Option): void; + unknownOption(flag: string): void; + _excessArguments(receivedArgs: string[]): void; + unknownCommand(): void; + version(str: string, flags?: string | undefined, description?: string | undefined): string | any | undefined; + _version: string | undefined; + _versionOptionName: string | undefined; + description(str?: string | undefined, argsDescription?: any): string | commander.Command; + summary(str?: string | undefined): string | commander.Command; + alias(alias?: string | undefined): string | commander.Command; + aliases(aliases?: string[] | undefined): string[] | commander.Command; + usage(str?: string | undefined): string | commander.Command; + _usage: string | undefined; + name(str?: string | undefined): string | commander.Command; + nameFromFilename(filename: string): commander.Command; + executableDir(path?: string | undefined): string | commander.Command | null; + helpInformation(contextOptions?: { + error: boolean; + } | undefined): string; + _getHelpContext(contextOptions: any): { + error: boolean; + }; + outputHelp(contextOptions?: Function | { + error: boolean; + } | undefined): void; + helpOption(flags?: string | boolean | undefined, description?: string | undefined): commander.Command; + help(contextOptions?: { + error: boolean; + } | undefined): void; + addHelpText(position: string, text: string | Function): commander.Command; + addListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + on(eventName: string | symbol, listener: (...args: any[]) => void): any; + once(eventName: string | symbol, listener: (...args: any[]) => void): any; + removeListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + off(eventName: string | symbol, listener: (...args: any[]) => void): any; + removeAllListeners(event?: string | symbol | undefined): any; + setMaxListeners(n: number): any; + getMaxListeners(): number; + listeners(eventName: string | symbol): Function[]; + rawListeners(eventName: string | symbol): Function[]; + emit(eventName: string | symbol, ...args: any[]): boolean; + listenerCount(eventName: string | symbol, listener?: Function | undefined): number; + prependListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + eventNames(): (string | symbol)[]; +}; +export const createCommand: (name?: string | undefined) => commander.Command; +export const createArgument: (name: string, description?: string | undefined) => commander.Argument; +export const createOption: (flags: string, description?: string | undefined) => commander.Option; +export const CommanderError: typeof commander.CommanderError; +export const InvalidArgumentError: typeof commander.InvalidArgumentError; +export const InvalidOptionArgumentError: typeof commander.InvalidArgumentError; +export const Command: typeof commander.Command; +export const Argument: typeof commander.Argument; +export const Option: typeof commander.Option; +export const Help: typeof commander.Help; +import commander from './index.js'; +//# sourceMappingURL=esm.d.mts.map \ No newline at end of file diff --git a/typings/exports/esm.d.mts.map b/typings/exports/esm.d.mts.map new file mode 100644 index 000000000..6f79a7861 --- /dev/null +++ b/typings/exports/esm.d.mts.map @@ -0,0 +1 @@ +{"version":3,"file":"esm.d.mts","sourceRoot":"","sources":["../../lib/exports/esm.mjs"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAsB,YAAY"} \ No newline at end of file diff --git a/typings/exports/index.d.ts b/typings/exports/index.d.ts new file mode 100644 index 000000000..6d6542e64 --- /dev/null +++ b/typings/exports/index.d.ts @@ -0,0 +1,184 @@ +/// +export = commander; +declare const commander: { + program: any; + Command: typeof Command; + Argument: typeof Argument; + Option: typeof Option; + Help: typeof Help; + CommanderError: typeof CommanderError; + InvalidArgumentError: typeof InvalidArgumentError; + InvalidOptionArgumentError: typeof InvalidArgumentError; + commands: Command[]; + options: Option[]; + parent: any; + _allowUnknownOption: boolean; + _allowExcessArguments: boolean; + _args: Argument[]; + args: string[]; + rawArgs: any[]; + processedArgs: any[]; + _scriptPath: any; + _name: string; + _optionValues: {}; + _optionValueSources: {}; + _storeOptionsAsProperties: boolean; + _actionHandler: ((args: any) => any) | null; + _executableHandler: boolean; + _executableFile: any; + _executableDir: string | null; + _defaultCommandName: string | null; + _exitCallback: any; + _aliases: any[]; + _combineFlagAndOptionalValue: boolean; + _description: string; + _summary: string; + _argsDescription: any; + _enablePositionalOptions: boolean; + _passThroughOptions: boolean; + _lifeCycleHooks: {}; + _showHelpAfterError: string | boolean; + _showSuggestionAfterError: boolean; + _outputConfiguration: { + writeOut: (str: any) => boolean; + writeErr: (str: any) => boolean; + getOutHelpWidth: () => number | undefined; + getErrHelpWidth: () => number | undefined; + outputError: (str: any, write: any) => any; + }; + _hidden: boolean; + _hasHelpOption: boolean; + _helpFlags: string; + _helpDescription: string; + _helpShortFlag: string; + _helpLongFlag: string; + _addImplicitHelpCommand: boolean | undefined; + _helpCommandName: string; + _helpCommandnameAndArgs: string; + _helpCommandDescription: string; + _helpConfiguration: {}; + copyInheritedSettings(sourceCommand: Command): Command; + command(nameAndArgs: string, actionOptsOrExecDesc?: any, execOpts?: any): Command; + createCommand(name?: string | undefined): Command; + createHelp(): Help; + configureHelp(configuration?: any): any; + configureOutput(configuration?: any): any; + showHelpAfterError(displayHelp?: string | boolean | undefined): Command; + showSuggestionAfterError(displaySuggestion?: boolean | undefined): Command; + addCommand(cmd: Command, opts?: any): Command; + createArgument(name: string, description?: string | undefined): Argument; + argument(name: string, description?: string | undefined, fn?: any, defaultValue?: any): Command; + arguments(names: string): Command; + addArgument(argument: Argument): Command; + addHelpCommand(enableOrNameAndArgs: any, description: any): Command; + _hasImplicitHelpCommand(): boolean; + hook(event: string, listener: Function): Command; + exitOverride(fn?: Function | undefined): Command; + _exit(exitCode: number, code: string, message: string): void; + action(fn: Function): Command; + createOption(flags: string, description?: string | undefined): Option; + addOption(option: Option): Command; + _optionEx(config: any, flags: any, description: any, fn: any, defaultValue: any): Command; + option(flags: string, description?: string | undefined, fn?: any, defaultValue?: any): Command; + requiredOption(flags: string, description?: string | undefined, fn?: any, defaultValue?: any): Command; + combineFlagAndOptionalValue(combine?: boolean | undefined): any; + allowUnknownOption(allowUnknown?: boolean | undefined): any; + allowExcessArguments(allowExcess?: boolean | undefined): any; + enablePositionalOptions(positional?: boolean | undefined): any; + passThroughOptions(passThrough?: boolean | undefined): any; + storeOptionsAsProperties(storeAsProperties?: boolean | undefined): Command; + getOptionValue(key: string): any; + setOptionValue(key: string, value: any): Command; + setOptionValueWithSource(key: string, value: any, source?: string | undefined): Command; + getOptionValueSource(key: string): string | undefined; + getOptionValueSourceWithGlobals(key: string): string | undefined; + _prepareUserArgs(argv: any, parseOptions: any): any; + parse(argv?: string[] | undefined, parseOptions?: { + from?: string | undefined; + } | undefined): Command; + parseAsync(argv?: string[] | undefined, parseOptions?: { + from: string; + } | undefined): Promise; + _executeSubCommand(subcommand: any, args: any): void; + runningCommand: import("child_process").ChildProcess | undefined; + _dispatchSubcommand(commandName: any, operands: any, unknown: any): void | Promise; + _dispatchHelpCommand(subcommandName: any): void | Promise; + _checkNumberOfArguments(): void; + _processArguments(): void; + _chainOrCall(promise: Promise | undefined, fn: Function): Promise | undefined; + _chainOrCallHooks(promise: Promise | undefined, event: string): Promise | undefined; + _chainOrCallSubCommandHook(promise: Promise | undefined, subCommand: Command, event: string): Promise | undefined; + _parseCommand(operands: any, unknown: any): void | Promise; + _findCommand(name: any): Command | undefined; + _findOption(arg: string): Option | undefined; + _checkForMissingMandatoryOptions(): void; + _checkForConflictingLocalOptions(): void; + _checkForConflictingOptions(): void; + parseOptions(argv: string[]): { + operands: string[]; + unknown: string[]; + }; + opts(): any; + optsWithGlobals(): any; + error(message: string, errorOptions?: { + code?: string | undefined; + exitCode?: number | undefined; + } | undefined): void; + _parseOptionsEnv(): void; + _parseOptionsImplied(): void; + missingArgument(name: string): void; + optionMissingArgument(option: Option): void; + missingMandatoryOptionValue(option: Option): void; + _conflictingOption(option: Option, conflictingOption: Option): void; + unknownOption(flag: string): void; + _excessArguments(receivedArgs: string[]): void; + unknownCommand(): void; + version(str: string, flags?: string | undefined, description?: string | undefined): string | any | undefined; + _version: string | undefined; + _versionOptionName: string | undefined; + description(str?: string | undefined, argsDescription?: any): string | Command; + summary(str?: string | undefined): string | Command; + alias(alias?: string | undefined): string | Command; + aliases(aliases?: string[] | undefined): string[] | Command; + usage(str?: string | undefined): string | Command; + _usage: string | undefined; + name(str?: string | undefined): string | Command; + nameFromFilename(filename: string): Command; + executableDir(path?: string | undefined): string | Command | null; + helpInformation(contextOptions?: { + error: boolean; + } | undefined): string; + _getHelpContext(contextOptions: any): { + error: boolean; + }; + outputHelp(contextOptions?: Function | { + error: boolean; + } | undefined): void; + helpOption(flags?: string | boolean | undefined, description?: string | undefined): Command; + help(contextOptions?: { + error: boolean; + } | undefined): void; + addHelpText(position: string, text: string | Function): Command; + addListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + on(eventName: string | symbol, listener: (...args: any[]) => void): any; + once(eventName: string | symbol, listener: (...args: any[]) => void): any; + removeListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + off(eventName: string | symbol, listener: (...args: any[]) => void): any; + removeAllListeners(event?: string | symbol | undefined): any; + setMaxListeners(n: number): any; + getMaxListeners(): number; + listeners(eventName: string | symbol): Function[]; + rawListeners(eventName: string | symbol): Function[]; + emit(eventName: string | symbol, ...args: any[]): boolean; + listenerCount(eventName: string | symbol, listener?: Function | undefined): number; + prependListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): any; + eventNames(): (string | symbol)[]; +}; +import { Command } from "../command.js"; +import { Argument } from "../argument.js"; +import { Option } from "../option.js"; +import { Help } from "../help.js"; +import { CommanderError } from "../error.js"; +import { InvalidArgumentError } from "../error.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/typings/exports/index.d.ts.map b/typings/exports/index.d.ts.map new file mode 100644 index 000000000..43c6478c7 --- /dev/null +++ b/typings/exports/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/exports/index.js"],"names":[],"mappings":";;AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkC"} \ No newline at end of file diff --git a/typings/help.d.ts b/typings/help.d.ts new file mode 100644 index 000000000..d7ac099ac --- /dev/null +++ b/typings/help.d.ts @@ -0,0 +1,182 @@ +/** + * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS` + * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types + */ +export type Argument = import("./argument.js").Argument; +/** + * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS` + * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types + */ +export type Command = import("./command.js").Command; +/** + * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS` + * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types + */ +export type Option = import("./option.js").Option; +/** + * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS` + * https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types + * @typedef { import("./argument.js").Argument } Argument + * @typedef { import("./command.js").Command } Command + * @typedef { import("./option.js").Option } Option + */ +export class Help { + helpWidth: any; + sortSubcommands: boolean; + sortOptions: boolean; + showGlobalOptions: boolean; + /** + * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one. + * + * @param {Command} cmd + * @returns {Command[]} + */ + visibleCommands(cmd: Command): Command[]; + /** + * Compare options for sort. + * + * @param {Option} a + * @param {Option} b + * @returns number + */ + compareOptions(a: Option, b: Option): any; + /** + * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one. + * + * @param {Command} cmd + * @returns {Option[]} + */ + visibleOptions(cmd: Command): Option[]; + /** + * Get an array of the visible global options. (Not including help.) + * + * @param {Command} cmd + * @returns {Option[]} + */ + visibleGlobalOptions(cmd: Command): Option[]; + /** + * Get an array of the arguments if any have a description. + * + * @param {Command} cmd + * @returns {Argument[]} + */ + visibleArguments(cmd: Command): Argument[]; + /** + * Get the command term to show in the list of subcommands. + * + * @param {Command} cmd + * @returns {string} + */ + subcommandTerm(cmd: Command): string; + /** + * Get the option term to show in the list of options. + * + * @param {Option} option + * @returns {string} + */ + optionTerm(option: Option): string; + /** + * Get the argument term to show in the list of arguments. + * + * @param {Argument} argument + * @returns {string} + */ + argumentTerm(argument: Argument): string; + /** + * Get the longest command term length. + * + * @param {Command} cmd + * @param {Help} helper + * @returns {number} + */ + longestSubcommandTermLength(cmd: Command, helper: Help): number; + /** + * Get the longest option term length. + * + * @param {Command} cmd + * @param {Help} helper + * @returns {number} + */ + longestOptionTermLength(cmd: Command, helper: Help): number; + /** + * Get the longest global option term length. + * + * @param {Command} cmd + * @param {Help} helper + * @returns {number} + */ + longestGlobalOptionTermLength(cmd: Command, helper: Help): number; + /** + * Get the longest argument term length. + * + * @param {Command} cmd + * @param {Help} helper + * @returns {number} + */ + longestArgumentTermLength(cmd: Command, helper: Help): number; + /** + * Get the command usage to be displayed at the top of the built-in help. + * + * @param {Command} cmd + * @returns {string} + */ + commandUsage(cmd: Command): string; + /** + * Get the description for the command. + * + * @param {Command} cmd + * @returns {string} + */ + commandDescription(cmd: Command): string; + /** + * Get the subcommand summary to show in the list of subcommands. + * (Fallback to description for backwards compatibility.) + * + * @param {Command} cmd + * @returns {string} + */ + subcommandDescription(cmd: Command): string; + /** + * Get the option description to show in the list of options. + * + * @param {Option} option + * @return {string} + */ + optionDescription(option: Option): string; + /** + * Get the argument description to show in the list of arguments. + * + * @param {Argument} argument + * @return {string} + */ + argumentDescription(argument: Argument): string; + /** + * Generate the built-in help text. + * + * @param {Command} cmd + * @param {Help} helper + * @returns {string} + */ + formatHelp(cmd: Command, helper: Help): string; + /** + * Calculate the pad width from the maximum term length. + * + * @param {Command} cmd + * @param {Help} helper + * @returns {number} + */ + padWidth(cmd: Command, helper: Help): number; + /** + * Wrap the given string to width characters per line, with lines after the first indented. + * Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted. + * + * @param {string} str + * @param {number} width + * @param {number} indent + * @param {number} [minColumnWidth=40] + * @return {string} + * + */ + wrap(str: string, width: number, indent: number, minColumnWidth?: number | undefined): string; +} +//# sourceMappingURL=help.d.ts.map \ No newline at end of file diff --git a/typings/help.d.ts.map b/typings/help.d.ts.map new file mode 100644 index 000000000..f921de17a --- /dev/null +++ b/typings/help.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../lib/help.js"],"names":[],"mappings":";;;;uBAKc,OAAO,eAAe,EAAE,QAAQ;;;;;sBAChC,OAAO,cAAc,EAAE,OAAO;;;;;qBAC9B,OAAO,aAAa,EAAE,MAAM;AAL1C;;;;;;GAMG;AAGH;IAEI,eAA0B;IAC1B,yB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No newline at end of file diff --git a/typings/option.d.ts b/typings/option.d.ts new file mode 100644 index 000000000..b100b4648 --- /dev/null +++ b/typings/option.d.ts @@ -0,0 +1,180 @@ +export class Option { + /** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {string} flags + * @param {string} [description] + */ + constructor(flags: string, description?: string | undefined); + flags: string; + description: string; + required: boolean; + optional: boolean; + variadic: boolean; + mandatory: boolean; + short: any; + long: any; + negate: any; + defaultValue: any; + defaultValueDescription: string | undefined; + presetArg: any; + envVar: string | undefined; + parseArg: Function | ((arg: any, previous: any) => any) | undefined; + hidden: boolean; + argChoices: string[] | undefined; + conflictsWith: any[]; + implied: any; + /** + * Set the default value, and optionally supply the description to be displayed in the help. + * + * @param {any} value + * @param {string} [description] + * @return {Option} + */ + default(value: any, description?: string | undefined): Option; + /** + * Preset to use when option used without option-argument, especially optional but also boolean and negated. + * The custom processing (parseArg) is called. + * + * @example + * new Option('--color').default('GREYSCALE').preset('RGB'); + * new Option('--donate [amount]').preset('20').argParser(parseFloat); + * + * @param {any} arg + * @return {Option} + */ + preset(arg: any): Option; + /** + * Add option name(s) that conflict with this option. + * An error will be displayed if conflicting options are found during parsing. + * + * @example + * new Option('--rgb').conflicts('cmyk'); + * new Option('--js').conflicts(['ts', 'jsx']); + * + * @param {string | string[]} names + * @return {Option} + */ + conflicts(names: string | string[]): Option; + /** + * Specify implied option values for when this option is set and the implied options are not. + * + * The custom processing (parseArg) is not called on the implied values. + * + * @example + * program + * .addOption(new Option('--log', 'write logging information to file')) + * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' })); + * + * @param {Object} impliedOptionValues + * @return {Option} + */ + implies(impliedOptionValues: any): Option; + /** + * Set environment variable to check for option value. + * + * An environment variable is only used if when processed the current option value is + * undefined, or the source of the current value is 'default' or 'config' or 'env'. + * + * @param {string} name + * @return {Option} + */ + env(name: string): Option; + /** + * Set the custom handler for processing CLI option arguments into option values. + * + * @param {Function} [fn] + * @return {Option} + */ + argParser(fn?: Function | undefined): Option; + /** + * Whether the option is mandatory and must have a value after parsing. + * + * @param {boolean} [mandatory=true] + * @return {Option} + */ + makeOptionMandatory(mandatory?: boolean | undefined): Option; + /** + * Hide option in help. + * + * @param {boolean} [hide=true] + * @return {Option} + */ + hideHelp(hide?: boolean | undefined): Option; + /** + * @package + */ + _concatValue(value: any, previous: any): any[]; + /** + * Only allow option value to be one of choices. + * + * @param {string[]} values + * @return {Option} + */ + choices(values: string[]): Option; + /** + * Return option name. + * + * @return {string} + */ + name(): string; + /** + * Return option name, in a camelcase format that can be used + * as a object attribute key. + * + * @return {string} + * @package + */ + attributeName(): string; + /** + * Check if `arg` matches the short or long flag. + * + * @param {string} arg + * @return {boolean} + * @package + */ + is(arg: string): boolean; + /** + * Return whether a boolean option. + * + * Options are one of boolean, negated, required argument, or optional argument. + * + * @return {boolean} + * @package + */ + isBoolean(): boolean; +} +/** + * Split the short and long flag out of something like '-m,--mixed ' + * + * @package + */ +export function splitOptionFlags(flags: any): { + shortFlag: any; + longFlag: any; +}; +/** + * This class is to make it easier to work with dual options, without changing the existing + * implementation. We support separate dual options for separate positive and negative options, + * like `--build` and `--no-build`, which share a single option value. This works nicely for some + * use cases, but is tricky for others where we want separate behaviours despite + * the single shared option value. + */ +export class DualOptions { + /** + * @param {Option[]} options + */ + constructor(options: Option[]); + positiveOptions: Map; + negativeOptions: Map; + dualOptions: Set; + /** + * Did the value come from the option, and not from possible matching dual option? + * + * @param {any} value + * @param {Option} option + * @returns {boolean} + */ + valueFromOption(value: any, option: Option): boolean; +} +//# sourceMappingURL=option.d.ts.map \ No newline at end of file diff --git a/typings/option.d.ts.map b/typings/option.d.ts.map new file mode 100644 index 000000000..e67448cfe --- /dev/null +++ b/typings/option.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../lib/option.js"],"names":[],"mappings":"AAEA;IACE;;;;;OAKG;IAEH,mBAJW,MAAM,oCA6BhB;IAxBC,cAAkB;IAClB,oBAAoC;IAEpC,kBAAmC;IACnC,kBAAmC;IAEnC,kBAA4C;IAC5C,mBAAsB;IAEtB,WAAkC;IAClC,UAAgC;IAChC,YAAmB;IAInB,kBAA6B;IAC7B,4CAAwC;IACxC,eAA0B;IAC1B,2BAAuB;IACvB,oEAAyB;IACzB,gBAAmB;IACnB,iCAA2B;IAC3B,qBAAuB;IACvB,aAAwB;IAG1B;;;;;;OAMG;IAEH,eALW,GAAG,qCAEF,MAAM,CAOjB;IAED;;;;;;;;;;OAUG;IAEH,YAJW,GAAG,GACF,MAAM,CAMjB;IAED;;;;;;;;;;OAUG;IAEH,iBAJW,MAAM,GAAG,MAAM,EAAE,GAChB,MAAM,CAMjB;IAED;;;;;;;;;;;;OAYG;IACH,mCAFY,MAAM,CAUjB;IAED;;;;;;;;OAQG;IAEH,UAJW,MAAM,GACL,MAAM,CAMjB;IAED;;;;;OAKG;IAEH,sCAHY,MAAM,CAMjB;IAED;;;;;OAKG;IAEH,sDAHY,MAAM,CAMjB;IAED;;;;;OAKG;IAEH,sCAHY,MAAM,CAMjB;IAED;;OAEG;IAEH,+CAMC;IAED;;;;;OAKG;IAEH,gBAJW,MAAM,EAAE,GACP,MAAM,CAgBjB;IAED;;;;OAIG;IAEH,QAHY,MAAM,CAQjB;IAED;;;;;;OAMG;IAEH,iBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IAEH,QALW,MAAM,GACL,OAAO,CAMlB;IAED;;;;;;;OAOG;IAEH,aAJY,OAAO,CAMlB;CACF;AA+DD;;;;GAIG;AAEH;;;EAcC;AAjFD;;;;;;GAMG;AACH;IACE;;OAEG;IACH,qBAFW,MAAM,EAAE,EAkBlB;IAfC,+BAAgC;IAChC,+BAAgC;IAChC,sBAA4B;IAe9B;;;;;;OAMG;IACH,uBAJW,GAAG,UACH,MAAM,GACJ,OAAO,CAUnB;CACF"} \ No newline at end of file diff --git a/typings/suggestSimilar.d.ts b/typings/suggestSimilar.d.ts new file mode 100644 index 000000000..62b9a6847 --- /dev/null +++ b/typings/suggestSimilar.d.ts @@ -0,0 +1,9 @@ +/** + * Find close matches, restricted to same number of edits. + * + * @param {string} word + * @param {string[]} candidates + * @returns {string} + */ +export function suggestSimilar(word: string, candidates: string[]): string; +//# sourceMappingURL=suggestSimilar.d.ts.map \ No newline at end of file diff --git a/typings/suggestSimilar.d.ts.map b/typings/suggestSimilar.d.ts.map new file mode 100644 index 000000000..74ba0363c --- /dev/null +++ b/typings/suggestSimilar.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"suggestSimilar.d.ts","sourceRoot":"","sources":["../lib/suggestSimilar.js"],"names":[],"mappings":"AA8CA;;;;;;GAMG;AAEH,qCALW,MAAM,cACN,MAAM,EAAE,GACN,MAAM,CA8ClB"} \ No newline at end of file