{
  "manifest": {
    "name": "commander",
    "version": "8.3.0",
    "description": "the complete solution for node.js command-line programs",
    "keywords": [
      "commander",
      "command",
      "option",
      "parser",
      "cli",
      "argument",
      "args",
      "argv"
    ],
    "author": {
      "name": "TJ Holowaychuk",
      "email": "tj@vision-media.ca"
    },
    "license": "MIT",
    "repository": {
      "type": "git",
      "url": "https://github.com/tj/commander.js.git"
    },
    "scripts": {
      "lint": "eslint index.js esm.mjs \"lib/*.js\" \"tests/**/*.js\"",
      "typescript-lint": "eslint typings/*.ts tests/*.ts",
      "test": "jest && npm run test-typings",
      "test-esm": "node --experimental-modules ./tests/esm-imports-test.mjs",
      "test-typings": "tsd",
      "typescript-checkJS": "tsc --allowJS --checkJS index.js lib/*.js --noEmit",
      "test-all": "npm run test && npm run lint && npm run typescript-lint && npm run typescript-checkJS && npm run test-esm"
    },
    "main": "./index.js",
    "files": [
      "index.js",
      "lib/*.js",
      "esm.mjs",
      "typings/index.d.ts",
      "package-support.json"
    ],
    "type": "commonjs",
    "dependencies": {},
    "devDependencies": {
      "@types/jest": "^26.0.23",
      "@types/node": "^14.17.3",
      "@typescript-eslint/eslint-plugin": "^4.27.0",
      "@typescript-eslint/parser": "^4.27.0",
      "eslint": "^7.29.0",
      "eslint-config-standard": "^16.0.3",
      "eslint-plugin-jest": "^24.3.6",
      "jest": "^27.0.4",
      "standard": "^16.0.3",
      "ts-jest": "^27.0.3",
      "tsd": "^0.17.0",
      "typescript": "^4.3.4"
    },
    "types": "typings/index.d.ts",
    "jest": {
      "testEnvironment": "node",
      "collectCoverage": true,
      "transform": {
        "^.+\\.tsx?$": "ts-jest"
      },
      "testPathIgnorePatterns": [
        "/node_modules/"
      ]
    },
    "engines": {
      "node": ">= 12"
    },
    "support": true,
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-commander-8.3.0-4837ea1b2da67b9c616a67afbb0fafee567bca66-integrity/node_modules/commander/package.json",
    "readmeFilename": "Readme.md",
    "readme": "# Commander.js\n\n[![Build Status](https://github.com/tj/commander.js/workflows/build/badge.svg)](https://github.com/tj/commander.js/actions?query=workflow%3A%22build%22)\n[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)\n[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)\n[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)\n\nThe complete solution for [node.js](http://nodejs.org) command-line interfaces.\n\nRead this in other languages: English | [简体中文](./Readme_zh-CN.md)\n\n- [Commander.js](#commanderjs)\n  - [Installation](#installation)\n  - [Declaring _program_ variable](#declaring-program-variable)\n  - [Options](#options)\n    - [Common option types, boolean and value](#common-option-types-boolean-and-value)\n    - [Default option value](#default-option-value)\n    - [Other option types, negatable boolean and boolean|value](#other-option-types-negatable-boolean-and-booleanvalue)\n    - [Required option](#required-option)\n    - [Variadic option](#variadic-option)\n    - [Version option](#version-option)\n    - [More configuration](#more-configuration)\n    - [Custom option processing](#custom-option-processing)\n  - [Commands](#commands)\n    - [Command-arguments](#command-arguments)\n      - [More configuration](#more-configuration-1)\n      - [Custom argument processing](#custom-argument-processing)\n    - [Action handler](#action-handler)\n    - [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands)\n    - [Life cycle hooks](#life-cycle-hooks)\n  - [Automated help](#automated-help)\n    - [Custom help](#custom-help)\n    - [Display help after errors](#display-help-after-errors)\n    - [Display help from code](#display-help-from-code)\n    - [.usage and .name](#usage-and-name)\n    - [.helpOption(flags, description)](#helpoptionflags-description)\n    - [.addHelpCommand()](#addhelpcommand)\n    - [More configuration](#more-configuration-2)\n  - [Custom event listeners](#custom-event-listeners)\n  - [Bits and pieces](#bits-and-pieces)\n    - [.parse() and .parseAsync()](#parse-and-parseasync)\n    - [Parsing Configuration](#parsing-configuration)\n    - [Legacy options as properties](#legacy-options-as-properties)\n    - [TypeScript](#typescript)\n    - [createCommand()](#createcommand)\n    - [Node options such as `--harmony`](#node-options-such-as---harmony)\n    - [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands)\n    - [Override exit and output handling](#override-exit-and-output-handling)\n    - [Additional documentation](#additional-documentation)\n  - [Examples](#examples)\n  - [Support](#support)\n    - [Commander for enterprise](#commander-for-enterprise)\n\nFor information about terms used in this document see: [terminology](./docs/terminology.md)\n\n## Installation\n\n```bash\nnpm install commander\n```\n\n## Declaring _program_ variable\n\nCommander exports a global object which is convenient for quick programs.\nThis is used in the examples in this README for brevity.\n\n```js\nconst { program } = require('commander');\nprogram.version('0.0.1');\n```\n\nFor larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use.\n\n```js\nconst { Command } = require('commander');\nconst program = new Command();\nprogram.version('0.0.1');\n```\n\nFor named imports in ECMAScript modules, import from `commander/esm.mjs`.\n\n```js\n// index.mjs\nimport { Command } from 'commander/esm.mjs';\nconst program = new Command();\n```\n\nAnd in TypeScript:\n\n```ts\n// index.ts\nimport { Command } from 'commander';\nconst program = new Command();\n```\n\n## Options\n\nOptions are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space or vertical bar ('|').\n\nThe parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler.\n(You can also use `.getOptionValue()` and `.setOptionValue()` to work with a single option value,\nand `.getOptionValueSource()` and `.setOptionValueWithSource()` when it matters where the option value came from.)\n\nMulti-word options such as \"--template-engine\" are camel-cased, becoming `program.opts().templateEngine` etc.\n\nMultiple short flags may optionally be combined in a single argument following the dash: boolean flags, followed by a single option taking a value (possibly followed by the value).\nFor example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`.\n\nYou can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.\n\nBy default options on the command line are not positional, and can be specified before or after other arguments.\n\n### Common option types, boolean and value\n\nThe two most used option types are a boolean option, and an option which takes its value\nfrom the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.\n\nExample file: [options-common.js](./examples/options-common.js)\n\n```js\nprogram\n  .option('-d, --debug', 'output extra debugging')\n  .option('-s, --small', 'small pizza size')\n  .option('-p, --pizza-type <type>', 'flavour of pizza');\n\nprogram.parse(process.argv);\n\nconst options = program.opts();\nif (options.debug) console.log(options);\nconsole.log('pizza details:');\nif (options.small) console.log('- small pizza size');\nif (options.pizzaType) console.log(`- ${options.pizzaType}`);\n```\n\n```bash\n$ pizza-options -p\nerror: option '-p, --pizza-type <type>' argument missing\n$ pizza-options -d -s -p vegetarian\n{ debug: true, small: true, pizzaType: 'vegetarian' }\npizza details:\n- small pizza size\n- vegetarian\n$ pizza-options --pizza-type=cheese\npizza details:\n- cheese\n```\n\n`program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array. The parameter is optional and defaults to `process.argv`.\n\n### Default option value\n\nYou can specify a default value for an option which takes a value.\n\nExample file: [options-defaults.js](./examples/options-defaults.js)\n\n```js\nprogram\n  .option('-c, --cheese <type>', 'add the specified type of cheese', 'blue');\n\nprogram.parse();\n\nconsole.log(`cheese: ${program.opts().cheese}`);\n```\n\n```bash\n$ pizza-options\ncheese: blue\n$ pizza-options --cheese stilton\ncheese: stilton\n```\n\n### Other option types, negatable boolean and boolean|value\n\nYou can define a boolean option long name with a leading `no-` to set the option value to false when used.\nDefined alone this also makes the option true by default.\n\nIf you define `--foo` first, adding `--no-foo` does not change the default value from what it would\notherwise be. You can specify a default boolean value for a boolean option and it can be overridden on command line.\n\nExample file: [options-negatable.js](./examples/options-negatable.js)\n\n```js\nprogram\n  .option('--no-sauce', 'Remove sauce')\n  .option('--cheese <flavour>', 'cheese flavour', 'mozzarella')\n  .option('--no-cheese', 'plain with no cheese')\n  .parse();\n\nconst options = program.opts();\nconst sauceStr = options.sauce ? 'sauce' : 'no sauce';\nconst cheeseStr = (options.cheese === false) ? 'no cheese' : `${options.cheese} cheese`;\nconsole.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`);\n```\n\n```bash\n$ pizza-options\nYou ordered a pizza with sauce and mozzarella cheese\n$ pizza-options --sauce\nerror: unknown option '--sauce'\n$ pizza-options --cheese=blue\nYou ordered a pizza with sauce and blue cheese\n$ pizza-options --no-sauce --no-cheese\nYou ordered a pizza with no sauce and no cheese\n```\n\nYou can specify an option which may be used as a boolean option but may optionally take an option-argument\n(declared with square brackets like `--optional [value]`).\n\nExample file: [options-boolean-or-value.js](./examples/options-boolean-or-value.js)\n\n```js\nprogram\n  .option('-c, --cheese [type]', 'Add cheese with optional type');\n\nprogram.parse(process.argv);\n\nconst options = program.opts();\nif (options.cheese === undefined) console.log('no cheese');\nelse if (options.cheese === true) console.log('add cheese');\nelse console.log(`add cheese type ${options.cheese}`);\n```\n\n```bash\n$ pizza-options\nno cheese\n$ pizza-options --cheese\nadd cheese\n$ pizza-options --cheese mozzarella\nadd cheese type mozzarella\n```\n\nFor information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).\n\n### Required option\n\nYou may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing.\n\nExample file: [options-required.js](./examples/options-required.js)\n\n```js\nprogram\n  .requiredOption('-c, --cheese <type>', 'pizza must have cheese');\n\nprogram.parse();\n```\n\n```bash\n$ pizza\nerror: required option '-c, --cheese <type>' not specified\n```\n\n### Variadic option\n\nYou may make an option variadic by appending `...` to the value placeholder when declaring the option. On the command line you\ncan then specify multiple option-arguments, and the parsed option value will be an array. The extra arguments\nare read until the first argument starting with a dash. The special argument `--` stops option processing entirely. If a value\nis specified in the same argument as the option then no further values are read.\n\nExample file: [options-variadic.js](./examples/options-variadic.js)\n\n```js\nprogram\n  .option('-n, --number <numbers...>', 'specify numbers')\n  .option('-l, --letter [letters...]', 'specify letters');\n\nprogram.parse();\n\nconsole.log('Options: ', program.opts());\nconsole.log('Remaining arguments: ', program.args);\n```\n\n```bash\n$ collect -n 1 2 3 --letter a b c\nOptions:  { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }\nRemaining arguments:  []\n$ collect --letter=A -n80 operand\nOptions:  { number: [ '80' ], letter: [ 'A' ] }\nRemaining arguments:  [ 'operand' ]\n$ collect --letter -n 1 -n 2 3 -- operand\nOptions:  { number: [ '1', '2', '3' ], letter: true }\nRemaining arguments:  [ 'operand' ]\n```\n\nFor information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).\n\n### Version option\n\nThe optional `version` method adds handling for displaying the command version. The default option flags are `-V` and `--version`, and when present the command prints the version number and exits.\n\n```js\nprogram.version('0.0.1');\n```\n\n```bash\n$ ./examples/pizza -V\n0.0.1\n```\n\nYou may change the flags and description by passing additional parameters to the `version` method, using\nthe same syntax for flags as the `option` method.\n\n```js\nprogram.version('0.0.1', '-v, --vers', 'output the current version');\n```\n\n### More configuration\n\nYou can add most options using the `.option()` method, but there are some additional features available\nby constructing an `Option` explicitly for less common cases.\n\nExample files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js)\n\n```js\nprogram\n  .addOption(new Option('-s, --secret').hideHelp())\n  .addOption(new Option('-t, --timeout <delay>', 'timeout in seconds').default(60, 'one minute'))\n  .addOption(new Option('-d, --drink <size>', 'drink size').choices(['small', 'medium', 'large']))\n  .addOption(new Option('-p, --port <number>', 'port number').env('PORT'));\n```\n\n```bash\n$ extra --help\nUsage: help [options]\n\nOptions:\n  -t, --timeout <delay>  timeout in seconds (default: one minute)\n  -d, --drink <size>     drink cup size (choices: \"small\", \"medium\", \"large\")\n  -p, --port <number>    port number (env: PORT)\n  -h, --help             display help for command\n\n$ extra --drink huge\nerror: option '-d, --drink <size>' argument 'huge' is invalid. Allowed choices are small, medium, large.\n\n$ PORT=80 extra \nOptions:  { timeout: 60, port: '80' }\n```\n\n### Custom option processing\n\nYou may specify a function to do custom processing of option-arguments. The callback function receives two parameters,\nthe user specified option-argument and the previous value for the option. It returns the new value for the option.\n\nThis allows you to coerce the option-argument to the desired type, or accumulate values, or do entirely custom processing.\n\nYou can optionally specify the default/starting value for the option after the function parameter.\n\nExample file: [options-custom-processing.js](./examples/options-custom-processing.js)\n\n```js\nfunction myParseInt(value, dummyPrevious) {\n  // parseInt takes a string and a radix\n  const parsedValue = parseInt(value, 10);\n  if (isNaN(parsedValue)) {\n    throw new commander.InvalidArgumentError('Not a number.');\n  }\n  return parsedValue;\n}\n\nfunction increaseVerbosity(dummyValue, previous) {\n  return previous + 1;\n}\n\nfunction collect(value, previous) {\n  return previous.concat([value]);\n}\n\nfunction commaSeparatedList(value, dummyPrevious) {\n  return value.split(',');\n}\n\nprogram\n  .option('-f, --float <number>', 'float argument', parseFloat)\n  .option('-i, --integer <number>', 'integer argument', myParseInt)\n  .option('-v, --verbose', 'verbosity that can be increased', increaseVerbosity, 0)\n  .option('-c, --collect <value>', 'repeatable value', collect, [])\n  .option('-l, --list <items>', 'comma separated list', commaSeparatedList)\n;\n\nprogram.parse();\n\nconst options = program.opts();\nif (options.float !== undefined) console.log(`float: ${options.float}`);\nif (options.integer !== undefined) console.log(`integer: ${options.integer}`);\nif (options.verbose > 0) console.log(`verbosity: ${options.verbose}`);\nif (options.collect.length > 0) console.log(options.collect);\nif (options.list !== undefined) console.log(options.list);\n```\n\n```bash\n$ custom -f 1e2\nfloat: 100\n$ custom --integer 2\ninteger: 2\n$ custom -v -v -v\nverbose: 3\n$ custom -c a -c b -c c\n[ 'a', 'b', 'c' ]\n$ custom --list x,y,z\n[ 'x', 'y', 'z' ]\n```\n\n## Commands\n\nYou can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).\n\nIn the first parameter to `.command()` you specify the command name. You may append the command-arguments after the command name, or specify them separately using `.argument()`. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.\n\nYou can use `.addCommand()` to add an already configured subcommand to the program.\n\nFor example:\n\n```js\n// Command implemented using action handler (description is supplied separately to `.command`)\n// Returns new command for configuring.\nprogram\n  .command('clone <source> [destination]')\n  .description('clone a repository into a newly created directory')\n  .action((source, destination) => {\n    console.log('clone command called');\n  });\n\n// Command implemented using stand-alone executable file, indicated by adding description as second parameter to `.command`.\n// Returns `this` for adding more commands.\nprogram\n  .command('start <service>', 'start named service')\n  .command('stop [service]', 'stop named service, or all if no name supplied');\n\n// Command prepared separately.\n// Returns `this` for adding more commands.\nprogram\n  .addCommand(build.makeBuildCommand());\n```\n\nConfiguration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will\nremove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other\nsubcommand is specified ([example](./examples/defaultCommand.js)).\n\n### Command-arguments\n\nFor subcommands, you can specify the argument syntax in the call to `.command()` (as shown above). This\nis the only method usable for subcommands implemented using a stand-alone executable, but for other subcommands\nyou can instead use the following method.\n\nTo configure a command, you can use `.argument()` to specify each expected command-argument.\nYou supply the argument name and an optional description. The argument may be `<required>` or `[optional]`.\nYou can specify a default value for an optional command-argument.\n\nExample file: [argument.js](./examples/argument.js)\n\n```js\nprogram\n  .version('0.1.0')\n  .argument('<username>', 'user to login')\n  .argument('[password]', 'password for user, if required', 'no password given')\n  .action((username, password) => {\n    console.log('username:', username);\n    console.log('password:', password);\n  });\n```\n\n The last argument of a command can be variadic, and only the last argument.  To make an argument variadic you\n append `...` to the argument name. A variadic argument is passed to the action handler as an array. For example:\n\n```js\nprogram\n  .version('0.1.0')\n  .command('rmdir')\n  .argument('<dirs...>')\n  .action(function (dirs) {\n    dirs.forEach((dir) => {\n      console.log('rmdir %s', dir);\n    });\n  });\n```\n\nThere is a convenience method to add multiple arguments at once, but without descriptions:\n\n```js\nprogram\n  .arguments('<username> <password>');\n```\n\n#### More configuration\n\nThere are some additional features available by constructing an `Argument` explicitly for less common cases.\n\nExample file: [arguments-extra.js](./examples/arguments-extra.js)\n\n```js\nprogram\n  .addArgument(new commander.Argument('<drink-size>', 'drink cup size').choices(['small', 'medium', 'large']))\n  .addArgument(new commander.Argument('[timeout]', 'timeout in seconds').default(60, 'one minute'))\n```\n\n#### Custom argument processing\n\nYou may specify a function to do custom processing of command-arguments (like for option-arguments).\nThe callback function receives two parameters, the user specified command-argument and the previous value for the argument.\nIt returns the new value for the argument.\n\nThe processed argument values are passed to the action handler, and saved as `.processedArgs`.\n\nYou can optionally specify the default/starting value for the argument after the function parameter.\n\nExample file: [arguments-custom-processing.js](./examples/arguments-custom-processing.js)\n\n```js\nprogram\n  .command('add')\n  .argument('<first>', 'integer argument', myParseInt)\n  .argument('[second]', 'integer argument', myParseInt, 1000)\n  .action((first, second) => {\n    console.log(`${first} + ${second} = ${first + second}`);\n  })\n;\n```\n\n### Action handler\n\nThe action handler gets passed a parameter for each command-argument you declared, and two additional parameters\nwhich are the parsed options and the command object itself.\n\nExample file: [thank.js](./examples/thank.js)\n\n```js\nprogram\n  .argument('<name>')\n  .option('-t, --title <honorific>', 'title to use before name')\n  .option('-d, --debug', 'display some debugging')\n  .action((name, options, command) => {\n    if (options.debug) {\n      console.error('Called %s with options %o', command.name(), options);\n    }\n    const title = options.title ? `${options.title} ` : '';\n    console.log(`Thank-you ${title}${name}`);\n  });\n```\n\nYou may supply an `async` action handler, in which case you call `.parseAsync` rather than `.parse`.\n\n```js\nasync function run() { /* code goes here */ }\n\nasync function main() {\n  program\n    .command('run')\n    .action(run);\n  await program.parseAsync(process.argv);\n}\n```\n\nA command's options and arguments on the command line are validated when the command is used. Any unknown options or missing arguments will be reported as an error. You can suppress the unknown option checks with `.allowUnknownOption()`. By default it is not an error to\npass more arguments than declared, but you can make this an error with `.allowExcessArguments(false)`.\n\n### Stand-alone executable (sub)commands\n\nWhen `.command()` is invoked with a description argument, this tells Commander that you're going to use stand-alone executables for subcommands.\nCommander will search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-subcommand`, like `pm-install`, `pm-search`.\nYou can specify a custom name with the `executableFile` configuration option.\n\nYou handle the options for an executable (sub)command in the executable, and don't declare them at the top-level.\n\nExample file: [pm](./examples/pm)\n\n```js\nprogram\n  .version('0.1.0')\n  .command('install [name]', 'install one or more packages')\n  .command('search [query]', 'search with optional query')\n  .command('update', 'update installed packages', { executableFile: 'myUpdateSubCommand' })\n  .command('list', 'list packages installed', { isDefault: true });\n\nprogram.parse(process.argv);\n```\n\nIf the program is designed to be installed globally, make sure the executables have proper modes, like `755`.\n\n### Life cycle hooks\n\nYou can add callback hooks to a command for life cycle events.\n\nExample file: [hook.js](./examples/hook.js)\n\n```js\nprogram\n  .option('-t, --trace', 'display trace statements for commands')\n  .hook('preAction', (thisCommand, actionCommand) => {\n    if (thisCommand.opts().trace) {\n      console.log(`About to call action handler for subcommand: ${actionCommand.name()}`);\n      console.log('arguments: %O', actionCommand.args);\n      console.log('options: %o', actionCommand.opts());\n    }\n  });\n```\n\nThe callback hook can be `async`, in which case you call `.parseAsync` rather than `.parse`. You can add multiple hooks per event.\n\nThe supported events are:\n\n- `preAction`: called before action handler for this command and its subcommands\n- `postAction`: called after action handler for this command and its subcommands\n\nThe hook is passed the command it was added to, and the command running the action handler.\n\n## Automated help\n\nThe help information is auto-generated based on the information commander already knows about your program. The default\nhelp option is `-h,--help`.\n\nExample file: [pizza](./examples/pizza)\n\n```bash\n$ node ./examples/pizza --help\nUsage: pizza [options]\n\nAn application for pizza ordering\n\nOptions:\n  -p, --peppers        Add peppers\n  -c, --cheese <type>  Add the specified type of cheese (default: \"marble\")\n  -C, --no-cheese      You do not want any cheese\n  -h, --help           display help for command\n```\n\nA `help` command is added by default if your command has subcommands. It can be used alone, or with a subcommand name to show\nfurther help for the subcommand. These are effectively the same if the `shell` program has implicit help:\n\n```bash\nshell help\nshell --help\n\nshell help spawn\nshell spawn --help\n```\n\n### Custom help\n\nYou can add extra text to be displayed along with the built-in help.\n\nExample file: [custom-help](./examples/custom-help)\n\n```js\nprogram\n  .option('-f, --foo', 'enable some foo');\n\nprogram.addHelpText('after', `\n\nExample call:\n  $ custom-help --help`);\n```\n\nYields the following help output:\n\n```Text\nUsage: custom-help [options]\n\nOptions:\n  -f, --foo   enable some foo\n  -h, --help  display help for command\n\nExample call:\n  $ custom-help --help\n```\n\nThe positions in order displayed are:\n\n- `beforeAll`: add to the program for a global banner or header\n- `before`: display extra information before built-in help\n- `after`: display extra information after built-in help\n- `afterAll`: add to the program for a global footer (epilog)\n\nThe positions \"beforeAll\" and \"afterAll\" apply to the command and all its subcommands.\n\nThe second parameter can be a string, or a function returning a string. The function is passed a context object for your convenience. The properties are:\n\n- error: a boolean for whether the help is being displayed due to a usage error\n- command: the Command which is displaying the help\n\n### Display help after errors\n\nThe default behaviour for usage errors is to just display a short error message.\nYou can change the behaviour to show the full help or a custom help message after an error.\n\n```js\nprogram.showHelpAfterError();\n// or\nprogram.showHelpAfterError('(add --help for additional information)');\n```\n\n```sh\n$ pizza --unknown\nerror: unknown option '--unknown'\n(add --help for additional information)\n```\n\nYou can also show suggestions after an error for an unknown command or option.\n\n```js\nprogram.showSuggestionAfterError();\n```\n\n```sh\n$ pizza --hepl\nerror: unknown option '--hepl'\n(Did you mean --help?)\n```\n\n### Display help from code\n\n`.help()`: display help information and exit immediately. You can optionally pass `{ error: true }` to display on stderr and exit with an error status.\n\n`.outputHelp()`: output help information without exiting. You can optionally pass `{ error: true }` to display on stderr.\n\n`.helpInformation()`: get the built-in command help information as a string for processing or displaying yourself.\n\n### .usage and .name\n\nThese allow you to customise the usage description in the first line of the help. The name is otherwise\ndeduced from the (full) program arguments. Given:\n\n```js\nprogram\n  .name(\"my-command\")\n  .usage(\"[global options] command\")\n```\n\nThe help will start with:\n\n```Text\nUsage: my-command [global options] command\n```\n\n### .helpOption(flags, description)\n\nBy default every command has a help option. Override the default help flags and description. Pass false to disable the built-in help option.\n\n```js\nprogram\n  .helpOption('-e, --HELP', 'read more information');\n```\n\n### .addHelpCommand()\n\nA help command is added by default if your command has subcommands. You can explicitly turn on or off the implicit help command with `.addHelpCommand()` and `.addHelpCommand(false)`.\n\nYou can both turn on and customise the help command by supplying the name and description:\n\n```js\nprogram.addHelpCommand('assist [command]', 'show assistance');\n```\n\n### More configuration\n\nThe built-in help is formatted using the Help class.\nYou can configure the Help behaviour by modifying data properties and methods using `.configureHelp()`, or by subclassing using `.createHelp()` if you prefer.\n\nThe data properties are:\n\n- `helpWidth`: specify the wrap width, useful for unit tests\n- `sortSubcommands`: sort the subcommands alphabetically\n- `sortOptions`: sort the options alphabetically\n\nThere are methods getting the visible lists of arguments, options, and subcommands. There are methods for formatting the items in the lists, with each item having a _term_ and _description_. Take a look at `.formatHelp()` to see how they are used.\n\nExample file: [configure-help.js](./examples/configure-help.js)\n\n```js\nprogram.configureHelp({\n  sortSubcommands: true,\n  subcommandTerm: (cmd) => cmd.name() // Just show the name, instead of short usage.\n});\n```\n\n## Custom event listeners\n\nYou can execute custom actions by listening to command and option events.\n\n```js\nprogram.on('option:verbose', function () {\n  process.env.VERBOSE = this.opts().verbose;\n});\n```\n\n## Bits and pieces\n\n### .parse() and .parseAsync()\n\nThe first argument to `.parse` is the array of strings to parse. You may omit the parameter to implicitly use `process.argv`.\n\nIf the arguments follow different conventions than node you can pass a `from` option in the second parameter:\n\n- 'node': default, `argv[0]` is the application and `argv[1]` is the script being run, with user parameters after that\n- 'electron': `argv[1]` varies depending on whether the electron application is packaged\n- 'user': all of the arguments from the user\n\nFor example:\n\n```js\nprogram.parse(process.argv); // Explicit, node conventions\nprogram.parse(); // Implicit, and auto-detect electron\nprogram.parse(['-f', 'filename'], { from: 'user' });\n```\n\n### Parsing Configuration\n\nIf the default parsing does not suit your needs, there are some behaviours to support other usage patterns.\n\nBy default program options are recognised before and after subcommands. To only look for program options before subcommands, use `.enablePositionalOptions()`. This lets you use\nan option for a different purpose in subcommands.\n\nExample file: [positional-options.js](./examples/positional-options.js)\n\nWith positional options, the `-b` is a program option in the first line and a subcommand option in the second line:\n\n```sh\nprogram -b subcommand\nprogram subcommand -b\n```\n\nBy default options are recognised before and after command-arguments. To only process options that come\nbefore the command-arguments, use `.passThroughOptions()`. This lets you pass the  arguments and following options through to another program\nwithout needing to use `--` to end the option processing.\nTo use pass through options in a subcommand, the program needs to enable positional options.\n\nExample file: [pass-through-options.js](./examples/pass-through-options.js)\n\nWith pass through options, the `--port=80` is a program option in the first line and passed through as a command-argument in the second line:\n\n```sh\nprogram --port=80 arg\nprogram arg --port=80\n```\n\nBy default the option processing shows an error for an unknown option. To have an unknown option treated as an ordinary command-argument and continue looking for options, use `.allowUnknownOption()`. This lets you mix known and unknown options.\n\nBy default the argument processing does not display an error for more command-arguments than expected.\nTo display an error for excess arguments, use`.allowExcessArguments(false)`.\n\n### Legacy options as properties\n\nBefore Commander 7, the option values were stored as properties on the command.\nThis was convenient to code but the downside was possible clashes with\nexisting properties of `Command`. You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.\n\n```js\nprogram\n  .storeOptionsAsProperties()\n  .option('-d, --debug')\n  .action((commandAndOptions) => {\n    if (commandAndOptions.debug) {\n      console.error(`Called ${commandAndOptions.name()}`);\n    }\n  });\n```\n\n### TypeScript\n\nIf you use `ts-node` and  stand-alone executable subcommands written as `.ts` files, you need to call your program through node to get the subcommands called correctly. e.g.\n\n```bash\nnode -r ts-node/register pm.ts\n```\n\n### createCommand()\n\nThis factory function creates a new command. It is exported and may be used instead of using `new`, like:\n\n```js\nconst { createCommand } = require('commander');\nconst program = createCommand();\n```\n\n`createCommand` is also a method of the Command object, and creates a new command rather than a subcommand. This gets used internally\nwhen creating subcommands using `.command()`, and you may override it to\ncustomise the new subcommand (example file [custom-command-class.js](./examples/custom-command-class.js)).\n\n### Node options such as `--harmony`\n\nYou can enable `--harmony` option in two ways:\n\n- Use `#! /usr/bin/env node --harmony` in the subcommands scripts. (Note Windows does not support this pattern.)\n- Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning subcommand process.\n\n### Debugging stand-alone executable subcommands\n\nAn executable subcommand is launched as a separate child process.\n\nIf you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al,\nthe inspector port is incremented by 1 for the spawned subcommand.\n\nIf you are using VSCode to debug executable subcommands you need to set the `\"autoAttachChildProcesses\": true` flag in your launch.json configuration.\n\n### Override exit and output handling\n\nBy default Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override\nthis behaviour and optionally supply a callback. The default override throws a `CommanderError`.\n\nThe override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`. The default override behaviour is to throw the error, except for async handling of executable subcommand completion which carries on. The normal display of error messages or version or help\nis not affected by the override which is called after the display.\n\n```js\nprogram.exitOverride();\n\ntry {\n  program.parse(process.argv);\n} catch (err) {\n  // custom processing...\n}\n```\n\nBy default Commander is configured for a command-line application and writes to stdout and stderr.\nYou can modify this behaviour for custom applications. In addition, you can modify the display of error messages.\n\nExample file: [configure-output.js](./examples/configure-output.js)\n\n```js\nfunction errorColor(str) {\n  // Add ANSI escape codes to display text in red.\n  return `\\x1b[31m${str}\\x1b[0m`;\n}\n\nprogram\n  .configureOutput({\n    // Visibly override write routines as example!\n    writeOut: (str) => process.stdout.write(`[OUT] ${str}`),\n    writeErr: (str) => process.stdout.write(`[ERR] ${str}`),\n    // Highlight errors in color.\n    outputError: (str, write) => write(errorColor(str))\n  });\n```\n\n### Additional documentation\n\nThere is more information available about:\n\n- [deprecated](./docs/deprecated.md) features still supported for backwards compatibility\n- [options taking varying arguments](./docs/options-taking-varying-arguments.md)\n\n## Examples\n\nIn a single command program, you might not need an action handler.\n\nExample file: [pizza](./examples/pizza)\n\n```js\nconst { program } = require('commander');\n\nprogram\n  .description('An application for pizza ordering')\n  .option('-p, --peppers', 'Add peppers')\n  .option('-c, --cheese <type>', 'Add the specified type of cheese', 'marble')\n  .option('-C, --no-cheese', 'You do not want any cheese');\n\nprogram.parse();\n\nconst options = program.opts();\nconsole.log('you ordered a pizza with:');\nif (options.peppers) console.log('  - peppers');\nconst cheese = !options.cheese ? 'no' : options.cheese;\nconsole.log('  - %s cheese', cheese);\n```\n\nIn a multi-command program, you will have action handlers for each command (or stand-alone executables for the commands).\n\nExample file: [deploy](./examples/deploy)\n\n```js\nconst { Command } = require('commander');\nconst program = new Command();\n\nprogram\n  .version('0.0.1')\n  .option('-c, --config <path>', 'set config path', './deploy.conf');\n\nprogram\n  .command('setup [env]')\n  .description('run setup commands for all envs')\n  .option('-s, --setup_mode <mode>', 'Which setup mode to use', 'normal')\n  .action((env, options) => {\n    env = env || 'all';\n    console.log('read config from %s', program.opts().config);\n    console.log('setup for %s env(s) with %s mode', env, options.setup_mode);\n  });\n\nprogram\n  .command('exec <script>')\n  .alias('ex')\n  .description('execute the given remote cmd')\n  .option('-e, --exec_mode <mode>', 'Which exec mode to use', 'fast')\n  .action((script, options) => {\n    console.log('read config from %s', program.opts().config);\n    console.log('exec \"%s\" using %s mode and config %s', script, options.exec_mode, program.opts().config);\n  }).addHelpText('after', `\nExamples:\n  $ deploy exec sequential\n  $ deploy exec async`\n  );\n\nprogram.parse(process.argv);\n```\n\nMore samples can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.\n\n## Support\n\nThe current version of Commander is fully supported on Long Term Support versions of node, and requires at least node v12.\n(For older versions of node, use an older version of Commander. Commander version 2.x has the widest support.)\n\nThe main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.\n\n### Commander for enterprise\n\nAvailable as part of the Tidelift Subscription\n\nThe maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)\n",
    "licenseText": "(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz",
    "hash": "4837ea1b2da67b9c616a67afbb0fafee567bca66",
    "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
    "registry": "npm",
    "packageName": "commander",
    "cacheIntegrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== sha1-SDfqGy2me5xhamevuw+v7lZ7ymY="
  },
  "registry": "npm",
  "hash": "4837ea1b2da67b9c616a67afbb0fafee567bca66"
}