{"id":16682600,"url":"https://github.com/jchip/nix-clap","last_synced_at":"2025-03-17T00:32:43.928Z","repository":{"id":65411354,"uuid":"115734847","full_name":"jchip/nix-clap","owner":"jchip","description":"Simple, lightweight, flexible, and comprehensive Un*x Command Line Argument Parsing for NodeJS","archived":false,"fork":false,"pushed_at":"2025-01-08T20:23:29.000Z","size":290,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T15:29:06.762Z","etag":null,"topics":["arguments","command","line","parsing","unix"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jchip.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-29T15:51:50.000Z","updated_at":"2023-10-24T21:51:18.000Z","dependencies_parsed_at":"2024-04-04T18:31:01.662Z","dependency_job_id":"c95eeff0-a952-4a8c-a0af-6a70b025a06b","html_url":"https://github.com/jchip/nix-clap","commit_stats":{"total_commits":78,"total_committers":3,"mean_commits":26.0,"dds":0.08974358974358976,"last_synced_commit":"b1d4ad54daaa77952927443e51f09d90ecfdbe3e"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fnix-clap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fnix-clap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fnix-clap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fnix-clap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchip","download_url":"https://codeload.github.com/jchip/nix-clap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835942,"owners_count":20355611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arguments","command","line","parsing","unix"],"created_at":"2024-10-12T14:08:03.246Z","updated_at":"2025-03-17T00:32:43.627Z","avatar_url":"https://github.com/jchip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url] [![Build Status][build-image]][build-url]\n[![Dependency Status][daviddm-image]][daviddm-url] [![devDependency Status][daviddm-dev-image]][daviddm-dev-url]\n[![coverage][coverage-image]][coverage-url]\n\n# NixClap\n\nSimple, lightweight, flexible, and comprehensive Un\\*x Command Line Argument Parsing for NodeJS.\n\n# Features\n\n- Lightweight with minimal dependencies.\n- Comprehensive and flexible parsing capabilities similar to conventional Un\\*x parsing.\n- Flexible handling of options and commands that can take variadic params.\n- A simple and straightforward JSON interface for specifying options and commands.\n- Very informative result that tells you where each option came from.\n- [Webpack] friendly - allows bundling your cli into a single JS file with webpack.\n\n# Examples\n\nOptions only:\n\n```js\nconst NixClap = require(\"nix-clap\");\n\nconst options = {\n  names: {\n    desc: \"specify names\",\n    alias: [\"n\", \"m\"],\n    type: \"string array\"\n  }\n};\n\nconst parsed = new NixClap()\n  .version(\"1.0.0\")\n  .usage(\"$0 [options]\")\n  .init(options)\n  .parse();\n\nconsole.log(\"names\", parsed.opts.names);\n```\n\nWith commands:\n\n```js\nconst NixClap = require(\"nix-clap\");\n\nconst options = {\n  verbose: {\n    desc: \"enable verbose mode\",\n    alias: \"v\",\n    type: \"boolean\",\n    default: false\n  }\n};\n\nconst commands = {\n  compile: {\n    desc: \"run compile on the files\",\n    args: \"\u003cstring files...\u003e\",\n    exec: parsed =\u003e {\n      console.log(\"compile\", parsed.args.files, \"verbose\", parsed.opts.verbose);\n    }\n  }\n};\n\nconst parsed = new NixClap()\n  .version(\"1.0.0\")\n  .usage(\"$0 [options] \u003ccommand\u003e [options]\")\n  .init(options, commands)\n  .parse();\n```\n\n\u003e `version`, `help`, and `usage` must be called before `init`\n\nUsage:\n\n```bash\n$ my-prog compile --verbose file1.jsx file2.jsx file3.jsx\n```\n\n## More Examples\n\nSee [examples](./examples) folder for more working samples.\n\n# Parsing Capabilities\n\n## Options\n\nExample: `prog -xazvf=hello --foo-option hello bar -. --enable-blah`\n\n- Support `-` single char options or `--` long form options.\n- Options can have aliases.\n- Both option forms can have argument specified with `=` or space.\n  - ie: long form `--foo-option=bar` or `--foo-option bar`\n  - ie: short form `-f=bar` or `-f bar`\n- Both option forms can have variadic array args.\n  - ie: `--foo-option hello bar` or `-f hello bar`\n  - array args can have an optional type\n- `-` options can be compounded, like `-xazvf`.\n  - Last char can have args, like `-xazvf=hello` or `-xazvf hello`.\n  - Other chars are treated as `boolean` options automatically.\n- Variadic array args are terminated by any other options such as `-x` or `--xyz`, or explicitly with `-.` or `--.`\n  - ie: `cmd1 arg1 arg2 --some-array abc def ghi -. cmd2 arg1 arg2`.\n- Allow arbitrary unknown options but with arguments specified through `=` only.\n  - Since it's ambiguous whether to take a non-option arg following an unknown option as an argument or a command.\n- Counting number of option occurrences.\n- Boolean option can be negated with `--no-` prefix.\n- Allow custom value type coercions with a function or RegExp.\n\n## Commands\n\nExample: `prog sum 1 2 3 4`\n\n- Commands can have optional or required arguments.\n  - Each argument type defaults to `string`, but can have an optional type\n- Commands can have aliases.\n- Possible to specify multiple commands.\n- Commands can have variadic array arguments.\n- Variadic array args are terminated by any other options such as `-x` or `--xyz`, or explicitly with `-.` or `--.`\n  - ie: `prog order pizza soda -. pickup` (specifies two commands: `order` and `pickup`)\n- Command can have its own options that are binded to it only.\n- Top level options can be binded to specific commands only.\n- Unbind top level options can be specified before or after commands.\n- Allow arbitrary unknown commands that do not have arguments.\n- Allow multiple custom value type coercions for each command.\n\n## Terminating and Resuming\n\n- `--` terminates parsing, with remaining args returned in `parsed._`.\n- Parsing can be resumed after it's terminated.\n- `-.` or `--.` can terminate variadic params for commands and options.\n\n# Install\n\n```bash\nnpm i nix-clap --save\n```\n\n# Interface\n\nThis module exposes a class with a few methods.\n\nSee [APIs](#apis) for more details.\n\n## `options spec`\n\n```js\nconst options = {\n  \"some-option\": {\n    alias: [\"s\", \"so\"],\n    type: \"string\",\n    desc: \"description\",\n    default: \"foo\",\n    require: true,\n    requireArg: true,\n    allowCmd: [\"cmd1\", \"cmd2\"]\n  },\n  \"another-option\": {}\n};\n```\n\nWhere:\n\n| field        | description                                                                                                                       |\n| ------------ | --------------------------------------------------------------------------------------------------------------------------------- |\n| `alias`      | Specify aliases for the option, as a single string or an array of strings.                                                        |\n| `type`       | Type of argument for the option, one of: `string`, `number`, `float`, `boolean`, `array`, `count`, or [coercion](#value-coercion) |\n|              | `array` can set type of elements as one of `string`, `number`, `float`, `boolean` like this: `number array` or `float array`      |\n| `desc`       | Description for the option - a string or a function that returns string.                                                          |\n| `default`    | Default value to use for argument                                                                                                 |\n| `require`    | `true`/`false` whether this option must be specified.                                                                             |\n| `requireArg` | `true`/`false` whether argument for the option is required.                                                                       |\n| `allowCmd`   | list of command names this option is allow to follow only.                                                                        |\n\n## `commands spec`\n\n```js\nconst commands = {\n  cmd1: {\n    alias: [\"c\"],\n    args: \"\u003carg1\u003e [arg2..]\",\n    usage: \"$0 $1\",\n    desc: \"description\",\n    exec: argv =\u003e {},\n    default: true,\n    options: {}\n  },\n  cmd2: {}\n};\n```\n\nWhere:\n\n| field     | description                                                                                                                        |\n| --------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| `alias`   | Specify aliases for the command, as a single string or an array of strings.                                                        |\n| `args`    | Specify arguments for the command. `\u003c\u003e` means it's required and `[]` optional. See [rules](#rules-for-command-args) for more info. |\n| `usage`   | usage message when help for the command is invoked - a string or a function that returns a string.                                 |\n|           | `$0` will be replaced with program name and `$1` with command name.                                                                |\n| `desc`    | Description for the command - can be a string or a function that returns a string.                                                 |\n| `exec`    | The callback handler for the command - see [here](#command-exec-handler) for more details.                                         |\n| `default` | If `true`, set the command as default, which is invoked when no command was given in command line.                                 |\n|           | - Only one command can be default.                                                                                                 |\n|           | - Default command cannot have required args and must have the `exec` handler                                                       |\n| `options` | List of options arguments private to the command. Follows the same spec as [top level options](#options-spec)                      |\n\n### Rules for Command `args`\n\nRules for when specifying `args` for the command:\n\n- all required args must be before optional args\n- last one can specify variadic args with `..`, like `\u003cnames..\u003e` or `[names..]`\n- If you just want to get the list of args without naming it, you can specify with `\u003c..\u003e` or `[..]`\n- named args can have an optional type like `\u003cnumber value\u003e` or `[number values..]`\n  - supported types are `number`, `float`, `string`, `boolean`, or [coercion](#value-coercion)\n\n## Value Coercion\n\nIf none of the predefined types work for you, you can specify your own as a function or a RegExp, or any value.\n\nYou use any valid identifier for the value type, and then you define a field with the same name in your spec that can be:\n\n- `function` - will be called with the value to convert\n- `RegExp` - will be used to match the value. `undefined` is returned if it didn't match.\n- Anything else - will be used as the converted value.\n\nFor example:\n\n```js\nconst options = {\n  customFn: {\n    type: \"fnval\",\n    fnval: value =\u003e {\n      return value.substr(0, 1);\n    }\n  },\n  customRegex: {\n    type: \"rx\",\n    rx: /^test$/i\n  },\n  customAny: {\n    type: \"foo\",\n    foo: \"bar\"\n  }\n};\n\nconst commands = {\n  foo: {\n    args: \"\u003ctype1 value1\u003e \u003ctype2 value2\u003e\",\n    type1: value =\u003e `test-${value}`,\n    type2: /^test$/i\n  }\n};\n```\n\n## Parse Result\n\nUse the method [`parse`](#parseargv-start-parsed) to parse command line arguments. It will return a parse result object.\n\n```js\n{\n  source: {},\n  opts: {},\n  verbatim: {},\n  commands: [],\n  index: 5,\n  error,\n  _: [],\n  argv: []\n}\n```\n\nWhere:\n\n- `index` - the index in `argv` parse stopped\n- `error` - If parse failed and your `parse-fail` event handler throws, then this will contain the parse error. See [skip default event behaviors](#skip-default-event-behaviors) for more details.\n- `source`, `opts`, `verbatim` - objects containing info for the options. See [details here](#parse-result-source-and-opts-objects)\n- `commands` - array of parsed command objects. See [`commands`](#parse-result-commands-object) for more details.\n- `argv` - original array of argv\n- `_` - remaining args in the `argv` array in case parsing was terminated by `--`.\n\nIf any command with [`exec` handlers](#command-exec-handler) were specified, then `parse` will invoke them before returning the parse result object.\n\n### Parse Result `source` and `opts` objects\n\n- `opts` - contains actual value for each option\n- `source` - contains info about where the option value came from\n\n  - `cli` - option specified by user in the command line\n  - `default` - default value in your [options spec](#options-spec)\n  - `user` - values you applied by calling the [`applyConfig`](#applyconfigconfig-parsed-src) method\n\n- `verbatim` - contains original unprocessed value as given by the user in the command line\n\n  - This is an array of values if there was actual values from the user\n  - If there's no explicit value (ie. boolean or counting options), then this doesn't contain a field for the option.\n  - If it's a boolean but the user specified with `--no-` prefix, then this contains a field with the value `[\"no-\"]`\n\nFor example, with the following conditions:\n\n1. User specified `--foo-bar=test` in the command line\n2. You have an option `fooDefault` with default value `bar`\n3. You called `applyConfig` with `applyConfig({fooConfig: 1, fooBar: \"oops\"}, parsed)`\n\nYou would get the following in the parse result object:\n\n```js\n{\n  source: {\n    fooBar: \"cli\",\n    fooDefault: \"default\",\n    fooConfig: \"user\"\n  },\n  opts: {\n    fooBar: \"test\",\n    fooDefault: \"bar\",\n    fooConfig: 1\n  },\n  verbatim: {\n    fooBar: [\"test\"]\n  }\n}\n```\n\n\u003e Note that the value `oops` for `fooBar` passed to `applyConfig` is not used since user's specified value is used.\n\n### Parse Result `commands` object\n\nThe `commands` object is an array of parsed commands:\n\n```js\n{\n  commands: [\n    {\n      name: \"cmdName\",\n      long: \"cmdName\",\n      unknown: false,\n      args: {\n        foo: \"bar\",\n        variadic: [\"a\", \"b\"]\n      },\n      argList: [\"bar\", \"a\", \"b\"],\n      opts: {},\n      source: {},\n      verbatim: {}\n    }\n  ];\n}\n```\n\n- `name` is the name of the command used by the user in the command line that could be an alias\n- `long` is the original form of the command name (not the alias)\n- `unknown` - `true` if the command is not known\n- `args` - the processed named arguments\n- `argList` - list of all the arguments in unprocessed string form\n- `opts`, `source`, `verbatim` - info for the options private to the command\n\n### Command `exec` handler\n\nIf the command has an `exec` handler, then it will be called with two arguments:\n\n```js\nexec(result, parsed);\n```\n\n- First one is the object for the command\n- Second one is the overall parsed object\n\nInfo about the command object:\n\n```js\n{\n  name: \"cmdName\",\n  long: \"cmdName\",\n  args: {\n    foo: \"bar\",\n    variadic: [ \"a\", \"b\" ]\n  },\n  argList: [ \"bar\", \"a\", \"b\" ],\n  opts: {},\n  source: {},\n  verbatim: {}\n}\n```\n\nWhere `opts` and `source` contain both the command's private options and top level options.\n\n\u003e You can turn this off with the `skipExec` config flag passed to [`NixClap` constructor](#constructorconfig)\n\n## Events\n\n`NixClap` emits these events:\n\n- `help` - when `--help` is invoked, emitted with the parse result object.\n- `pre-help` - before output for `--help`\n- `post-help` - after output for `--help`\n- `help` - when `--help` is invoked, emitted with the parse result object.\n- `version` - when `--version` is invoked, emitted with the parse result object.\n- `parsed` - when all parsing is done but before command `exec` are invoked, emitted with `{ nixClap, parsed }` where `nixClap` is the NixClap instance.\n- `parse-fail` - when parse failed, emitted with parse result object, which has `error` field.\n- `unknown-option` - when an unknown option is found, emitted with option name\n- `unknown-command` - when an unknown command is found, emitted with command context, which has `name` field.\n- `no-action` - when you have commands with `exec` and user specified no command that triggered an `exec` call.\n- `exit` - When program is expected to terminate, emit with exit code.\n\n### Default Event Handlers\n\nNixClap has default handlers for these events:\n\n- `help` - Output help and emit `exit`\n- `version` - If `version` has been set, then output version and emit `exit`.\n- `parse-fail` - Output help and error message, and emit `exit`.\n- `unknown-option` - Throws Error `Unknown option ${name}`\n- `unknown-command` - Throws Error `Unkown command ${ctx.name}`\n- `no-action` - Output help with error `No command given` and emit `exit`\n- `exit` - calls `process.exit(code)`\n\n#### Skip Default Event Behaviors\n\nYou can remove the default event handlers with one of these approaches:\n\n- With the [`removeDefaultHandlers`](#removedefaulthandlers) method.\n- By passing in `handlers` object in the `config` for the constructor.\n\nFor example, using `removeDefaultHandlers`:\n\n```js\nconst nc = new NixClap().init(options, commands);\nconst parsed = nc.removeDefaultHandlers(\"parse-fail\").parse();\nif (parsed.error) {\n  // handle the parse error here\n}\n```\n\nUsing constructor config.\n\n```js\nconst parsed = new NixClap({ handlers: { \"parse-fail\": false } }).parse();\nif (parsed.error) {\n  // handle the parse error here\n}\n```\n\n## APIs\n\nThese are methods `NixClap` class supports.\n\n- [NixClap](#nixclap)\n- [Features](#features)\n- [Examples](#examples)\n  - [More Examples](#more-examples)\n- [Parsing Capabilities](#parsing-capabilities)\n  - [Options](#options)\n  - [Commands](#commands)\n  - [Terminating and Resuming](#terminating-and-resuming)\n- [Install](#install)\n- [Interface](#interface)\n  - [`options spec`](#options-spec)\n  - [`commands spec`](#commands-spec)\n    - [Rules for Command `args`](#rules-for-command-args)\n  - [Value Coercion](#value-coercion)\n  - [Parse Result](#parse-result)\n    - [Parse Result `source` and `opts` objects](#parse-result-source-and-opts-objects)\n    - [Parse Result `commands` object](#parse-result-commands-object)\n    - [Command `exec` handler](#command-exec-handler)\n  - [Events](#events)\n    - [Default Event Handlers](#default-event-handlers)\n      - [Skip Default Event Behaviors](#skip-default-event-behaviors)\n  - [APIs](#apis)\n    - [`constructor(config)`](#constructorconfig)\n    - [`version(v)`](#versionv)\n    - [`help(setting)`](#helpsetting)\n    - [`usage(msg)`, `cmdUsage(msg)`](#usagemsg-cmdusagemsg)\n    - [`init(options, commands)`](#initoptions-commands)\n    - [`parse(argv, start, parsed)`](#parseargv-start-parsed)\n    - [`parseAsync(argv, start, parsed)`](#parseasyncargv-start-parsed)\n    - [`showHelp(err, cmdName)`](#showhelperr-cmdname)\n    - [`removeDefaultHandlers()`](#removedefaulthandlers)\n    - [`applyConfig(config, parsed, src)`](#applyconfigconfig-parsed-src)\n    - [`runExec(parsed, skipDefault)`](#runexecparsed-skipdefault)\n    - [`runExecAsync(parsed, skipDefault)`](#runexecasyncparsed-skipdefault)\n- [Others](#others)\n\n### `constructor(config)`\n\n`config` is object with:\n\n- `name` - set the program name. Will auto detect from `process.argv` if not specified.\n- `version` - set the program version. Can also set with [`version`](#versionv) method.\n- `help` - custom help option setting. Can also set with [`help`](#helpsetting) method.\n- `usage` - usage message. Can also set with [`usage`](#usagemsg-cmdusagemsg) method.\n- `cmdUsage` - generic usage message for commands. Can also set with [`cmdUsage`](#usagemsg-cmdusagemsg) method.\n- `skipExec` - If true, will not call command `exec` handlers after parse.\n- `skipExecDefault` - if true, will not call default command `exec` handler after parse.\n  - In case you need to do something before invoking the `exec` handlers, you can set these flags and call the [`runExec(parsed, skipDefault)`](#runexecparsed-skipdefault) method yourself.\n- `output` - callback for printing to console. Should take string as param. Default to calling `process.stdout.write`\n- `handlers` - custom event handlers.\n\nThe `handlers` object can specify a function for each of the [events](#events) or set it to `false` to turn off the default handler.\n\nFor example, this config will replace handler for `parse-fail` and turn off the default `unknown-option` handler.\n\n```js\nconst nc = new NixClap({\n  handlers: {\n    \"parse-fail\": (parsed) =\u003e { ... },\n    \"unknown-option\": false\n  }\n});\n```\n\n### `version(v)`\n\nSet program version with a string. ie: `1.0.0`\n\nReturn: The `NixClap` instance itself.\n\n\u003e Must be called before the [`init`](#initoptions-commands) method.\n\n### `help(setting)`\n\nSet a custom option setting for invoking help. Default is:\n\nReturn: The `NixClap` instance itself.\n\n```js\n{\n  alias: \"h\",\n  desc: \"Show help\"\n}\n```\n\nOption name is always `help`. Call `help(false)` to turn off the default `--help` option.\n\n\u003e Must be called before the [`init`](#initoptions-commands) method.\n\n### `usage(msg)`, `cmdUsage(msg)`\n\nSet usage message for the program or command, which can be override by individual command's own usage.\n\n`msg` format is any string. `$0` will be replaced with program name and `$1` with command name.\n\nReturn: The `NixClap` instance itself.\n\n\u003e Must be called before the [`init`](#initoptions-commands) method.\n\n### `init(options, commands)`\n\nInitialize your options and commands\n\nReturn: The `NixClap` instance itself.\n\n### `parse(argv, start, parsed)`\n\nParse command line. Call without any params to parse `process.argv`.\n\nReturn: The parse result object.\n\n- `argv` - array of CLI args. Defaults to `process.argv`.\n- `start` - index for argv from where to start parsing\n- `parsed` - previous result from `parse`. If passed, then parsing will add new data to it.\n\n### `parseAsync(argv, start, parsed)`\n\nasync version of [parse](#parseargv-start-parsed).\n\n- It will use [runExecAsync](#runexecasyncparsed-skipdefault) to invoke command `exec` handlers serially.\n- The command handler can return a Promise, which will be awaited.\n\nReturn: A promise the resolve with the parse result object.\n\n### `showHelp(err, cmdName)`\n\nShow help message and then emit `exit`.\n\n- `err` - if valid, then `err.message` will be printed after help message and exit with code `1`.\n- `cmdName` - if valid, then will print help for the specific command.\n\n### `removeDefaultHandlers()`\n\nRemove NixClap's default handlers for the list of [event names](#events).\n\nIf you've replaced the handler through specifying `handlers` in `config` for the constructor, then this will not remove your handler.\n\nReturn: The `NixClap` instance itself.\n\n- You can pass in `\"*\"` to remove all default handlers.\n- You can pass in the event names you want to remove.\n\nie:\n\n```js\nnc.removeDefaultHandlers(\"parse-fail\", \"unknown-option\", \"unknown-command\");\n```\n\n### `applyConfig(config, parsed, src)`\n\nAllow you to apply extra config to the parsed object, overriding any `opts` with `source` not equal to `cli`.\n\nFor example, you can allow user to specify options in their `package.json` file, and apply those after the command line is parsed.\n\n- `config` - Config object containing user options config\n- `parsed` - The parse result object from NixClap.\n- `src` - String, source to set if override. Default to `user`\n\nExample on applying user config from `package.json`:\n\n```js\nconst pkg = require(path.resolve(\"package.json\"));\nconst parsed = nc.parse();\nnc.applyConfig(pkg.cliConfig, parsed);\n```\n\n### `runExec(parsed, skipDefault)`\n\nGo through the commands in parsed and call their `exec` handler.\n\n\u003e The [`parse`](#parseargv-start-parsed) method will call this at the end unless `skipExec` flag is set.\n\nReturn: The number of commands with `exec` was invoked.\n\n- `parsed` - The parse result object.\n- `skipDefault` - `boolean`, if `true` then do not invoke default command's `exec` handler when no command with `exec` handler was given.\n\n### `runExecAsync(parsed, skipDefault)`\n\nasync version of [runExec](#runexecparsed-skipdefault)\n\nReturn: A promise that resolve with the number of commands with `exec` invoked.\n\n# Others\n\n- [argparse]\n- [yargs]\n- [commander]\n- [optimist]\n- [clap]\n- [clap.js]\n\n[optimist]: https://www.npmjs.com/package/optimist\n[clap]: https://github.com/lahmatiy/clap\n[clap.js]: https://github.com/litert/clap.js\n[argparse]: https://github.com/nodeca/argparse\n[yargs]: https://github.com/yargs/yargs\n[commander]: https://github.com/tj/commander.js\n[build-image]: https://github.com/jchip/nix-clap/actions/workflows/node.js.yml/badge.svg\n[build-url]: https://github.com/jchip/nix-clap/actions/workflows/node.js.yml\n[npm-image]: https://badge.fury.io/js/nix-clap.svg\n[npm-url]: https://npmjs.org/package/nix-clap\n[daviddm-image]: https://david-dm.org/jchip/nix-clap/status.svg\n[daviddm-url]: https://david-dm.org/jchip/nix-clap\n[daviddm-dev-image]: https://david-dm.org/jchip/nix-clap/dev-status.svg\n[daviddm-dev-url]: https://david-dm.org/jchip/nix-clap?type=dev\n[webpack]: https://webpack.js.org/\n[coverage-image]: https://coveralls.io/repos/github/jchip/nix-clap/badge.svg?branch=master\n[coverage-url]: https://coveralls.io/github/jchip/nix-clap?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Fnix-clap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchip%2Fnix-clap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Fnix-clap/lists"}