{
  "_args": [
    [
      {
        "raw": "clp@^3.0.0",
        "scope": null,
        "escapedName": "clp",
        "name": "clp",
        "rawSpec": "^3.0.0",
        "spec": ">=3.0.0 <4.0.0",
        "type": "range"
      },
      "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/diable"
    ]
  ],
  "_from": "clp@>=3.0.0 <4.0.0",
  "_id": "clp@3.2.1",
  "_inCache": true,
  "_location": "/clp",
  "_nodeVersion": "4.0.0",
  "_npmUser": {
    "name": "ionicabizau",
    "email": "bizauionica@gmail.com"
  },
  "_npmVersion": "2.14.2",
  "_phantomChildren": {},
  "_requested": {
    "raw": "clp@^3.0.0",
    "scope": null,
    "escapedName": "clp",
    "name": "clp",
    "rawSpec": "^3.0.0",
    "spec": ">=3.0.0 <4.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/diable"
  ],
  "_resolved": "https://registry.npmjs.org/clp/-/clp-3.2.1.tgz",
  "_shasum": "af1ed66db895a5c9ce9b6d32e9c33dee02b3edf2",
  "_shrinkwrap": null,
  "_spec": "clp@^3.0.0",
  "_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/diable",
  "author": {
    "name": "Ionică Bizău",
    "email": "bizauionica@gmail.com",
    "url": "http://ionicabizau.net"
  },
  "blah": {
    "h_img": "http://i.imgur.com/Gcn3nvW.png"
  },
  "bugs": {
    "url": "https://github.com/IonicaBizau/node-clp/issues"
  },
  "dependencies": {
    "ansi-parser": "2.0.0",
    "le-table": "4.0.0",
    "ul": "5.0.0"
  },
  "description": "A tiny and fast command line arguments parser and help generator.",
  "devDependencies": {},
  "directories": {
    "example": "examples",
    "test": "test"
  },
  "dist": {
    "shasum": "af1ed66db895a5c9ce9b6d32e9c33dee02b3edf2",
    "tarball": "https://registry.npmjs.org/clp/-/clp-3.2.1.tgz"
  },
  "gitHead": "ded36653787b65a072603357af0d04c7bbb58e57",
  "homepage": "https://github.com/IonicaBizau/node-clp",
  "keywords": [
    "clp",
    "command",
    "line",
    "arguments",
    "parser"
  ],
  "license": "MIT",
  "main": "lib/index.js",
  "maintainers": [
    {
      "name": "ionicabizau",
      "email": "bizauionica@gmail.com"
    }
  ],
  "name": "clp",
  "optionalDependencies": {},
  "readme": "[![clp](http://i.imgur.com/Gcn3nvW.png)](#)\n\n# clp [![PayPal](https://img.shields.io/badge/%24-paypal-f39c12.svg)][paypal-donations] [![Version](https://img.shields.io/npm/v/clp.svg)](https://www.npmjs.com/package/clp) [![Downloads](https://img.shields.io/npm/dt/clp.svg)](https://www.npmjs.com/package/clp) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)\n\n> A tiny and fast command line arguments parser and help generator.\n\n## Installation\n\n```sh\n$ npm i --save clp\n```\n\n## Example\n\n```js\n#!/usr/bin/env node\n\n// Dependencies\nvar Clp = require(\"clp\");\n\n// Create options and add them\nvar nameOption = new Clp.Option([\"name\", \"n\"], \"Someone's name\", \"name\", \"Alice\")\n  , ageOption = new Clp.Option([\"age\", \"a\"], \"Someone's age\", \"age\")\n  ;\n\n// Create a new parser\nvar parser = new Clp({\n    name: \"Name Age\"\n  , version: \"v1.0\"\n  , process: false\n  , exe: \"name-age\"\n  , examples: \"name-age -a 10 --name Bob\"\n  , docs_url: \"https://github.com/IonicaBizau/node-clp\"\n  , notes: \"These are some final notes.\"\n}, [nameOption, ageOption]);\n\nparser.addExample(\"name-age -a 5 # will default the name to \\\"Alice\\\"\");\n\nparser.process();\n\n// Validate the age\nif (isNaN(parseInt(ageOption.value)) || ageOption.value < 0) {\n    return console.error(\"Invalid age.\");\n}\n\n// Validate the name\nif (!nameOption.value) {\n    return console.error(\"Invalid name.\");\n}\n\n// Use the values\nconsole.log(nameOption.value + \" is \" + ageOption.value + \" year old.\");\n```\n\n## Documentation\n\n### `CLP.Option(aliases, description, name, def)`\nCreates a new `CLPOption` instance.\n\nUsages:\n\n```js\nCLP.Option([\"age\", \"a\"], \"The age value.\", \"age\", 20);\nCLP.Option(\"age\", \"The age value.\", \"age\", 20);\nCLP.Option({\n    aliases: [\"age\", \"a\"]\n  , description: \"The age value.\"\n  , name: \"age\"\n  , def: 20\n  , handler: function (opt) {\n       // Do something with opt\n    }\n});\n```\n\n#### Params\n- **Array|Object** `aliases`: An array of strings representing the aliases  (e.g. `[\"name\", \"n\"]`), a string representing a single alias (e.g. `\"name\"`)\n or an object containing the following fields:\n\n - `aliases` (Array): An array of strings representing the\n    aliases (e.g. `[\"name\", \"n\"]`)\n - `def` (Anything): The default value.\n - `description` (String): The option description.\n - `name` (String): The option name. If provided, the parser will expect a value otherwise\n   will return or display an error.\n - `handler` (Function): The option handler which will be called when the\n   option is found in the arguments. The first parameter is the option\n   object and the scope is the `CLP` instance.\n- **String** `description`: The option description.\n- **String** `name`: The option name.\n- **Anything** `def`: The default value.\n\n#### Return\n- **CLPOption** An object containing the following fields:\n - `aliases` (Array): An array of strings containing the computed aliases,\n    the single letter being the first ones (e.g. `[\"-n\", \"--name\"]`).\n - `value` (null|String|DefaultValue): The option value which was found\n    after processing the arguments.\n - `def` (Anything): The provided default value.\n - `description` (String): The option description.\n - `name` (String): The option name.\n - `is_provided` (Boolean): A flag if the option was or not been provided.\n\n### `CLP(args, options, clpOptions)`\nCreates a new `CLP` (command line parser) instance.\n\nUsage\n\n```js\nvar parser = new CLP(); // will take the arguments from `process.argv`\nvar parser = new CLP(args); // default options, empty clpOptions\nvar parser = new CLP(options, clpOptions); // default arguments\nvar parser = new CLP(args, clpOptions); // default options\nvar parser = new CLP(args, options, clpOptions); // pass everything\nvar parser = new CLP(\"some command\", ...); // pass a command string instead of arguments\n```\n\n#### Params\n- **Array|String** `args`: An array of strings with the arguments or the command itself.\n- **Object** `options`: An object containing the following fields:\n - `allow_exit` (Boolean): A flag to allow exit or not (e.g. when `-h`\n   is passed). This is useful when *CLP* is used in executable scripts,\n   however, when you only want to parse an array you should turn this\n   off (default: `true`).\n - `help_opt` (Boolean): A flag to add the help option (default: `true`).\n - `version_opt` (Boolean): A flag to add the version option (default: `true`).\n - `name` (String): The application name (default: `\"No Name\"`).\n - `exe` (String): The executable name (default: `\"no-name\"`).\n - `version` (String): The application version (default: `\"No Version\"`).\n - `process` (Boolean): A flag to process the CLP options imediatelly (default: `false`).\n - `docs_url` (String): The documentation url (default: `\"\"`).\n - `notes` (String): Final notes placed between examples and documentation\n   url in help content (default: `\"\"`).\n - `examples` (String|Array): A string or an array of string containing examples.\n- **Array** `clpOptions`:\n\n#### Return\n- **CLP** The `CLP` instance.\n\n### `addHelpOption(args, desc)`\nAdds the help option.\n\n#### Params\n- **Array** `args`: Optional alias options for the help option (default: `[\"h\", \"help\"]`).\n- **String** `desc`: The help description (default: `\"Displays this help.\"`).\n\n#### Return\n- **CLP** The `CLP` instance.\n\n### `addVersionOption(args, desc)`\nAdds the help option.\n\n#### Params\n- **Array** `args`: Optional alias options for the version option (default: `[\"h\", \"help\"]`).\n- **String** `desc`: The version description (default: `\"Displays version information.\"`).\n\n#### Return\n- **CLP** The `CLP` instance.\n\n### `addOption(opt)`\nAdds a new option to parse.\n\n#### Params\n- **CLPOption** `opt`: The `CLPOption` value to add.\n\n#### Return\n- **CLP** The `CLP` instance.\n\n### `addExample(example)`\nAdds a new example.\n\n#### Params\n- **String** `example`: The example to add.\n\n#### Return\n- **CLP** The `CLP` instance.\n\n### `process()`\nProcesses the arguments and adds the values in the options.\n\n#### Return\n- **Object** An object containing the following fields:\n - `error` (Error|null): An error that appeared during the arguments parsing.\n - `_` (Array): An array of strings representing the values which are not options, nor values, but other arguments (e.g. `some-tool --foo bar other arguments`).\n\n### `error(err_code, fields)`\nCreates an error by getting the error code and the error fields.\n\n#### Params\n- **String** `err_code`: The error code.\n- **Object** `fields`: An object with the error fields.\n\n#### Return\n- **Error** The error which was built.\n\n### `displayHelp()`\nGenerates the help content and returns it.\n\n#### Return\n- **String** The help information.\n\n### `displayVersion()`\nReturns the version information.\n\n#### Return\n- **String** The version information.\n\n## How to contribute\nHave an idea? Found a bug? See [how to contribute][contributing].\n\n## Where is this library used?\nIf you are using this library in one of your projects, add it in this list. :sparkles:\n\n - [`a-csv`](https://github.com/jillix/a-csv) by jillix\n\n - [`birthday`](https://github.com/IonicaBizau/birthday)\n\n - [`blah`](https://github.com/IonicaBizau/blah)\n\n - [`cdnjs-importer`](https://github.com/cdnjs/cdnjs-importer)\n\n - [`cli-gh-cal`](https://github.com/IonicaBizau/cli-gh-cal)\n\n - [`diable`](https://github.com/IonicaBizau/diable)\n\n - [`engine-tools`](https://github.com/jillix/engine-tools) by jillix\n\n - [`gh-notifier`](https://bitbucket.org/IonicaBizau/gh-notifier#readme)\n\n - [`ghcal`](https://github.com/IonicaBizau/ghcal)\n\n - [`git-issues`](https://github.com/softwarescales/git-issues) by Gabriel Petrovay\n\n - [`git-stats`](https://github.com/IonicaBizau/git-stats)\n\n - [`git-stats-importer`](https://github.com/IonicaBizau/git-stats-importer)\n\n - [`github-emojify`](https://github.com/IonicaBizau/github-emojifiy#readme)\n\n - [`github-labeller`](https://github.com/IonicaBizau/github-labeller#readme)\n\n - [`github-stats`](https://github.com/IonicaBizau/github-stats)\n\n - [`gpm`](https://github.com/IonicaBizau/gpm)\n\n - [`kindly-license`](https://github.com/IonicaBizau/kindly-license)\n\n - [`name-it`](https://github.com/IonicaBizau/name-it#readme)\n\n - [`namly`](https://github.com/IonicaBizau/namly#readme)\n\n - [`namy`](https://github.com/IonicaBizau/namy)\n\n - [`npmreserve`](https://github.com/IonicaBizau/npmreserve)\n\n - [`ssh-remote`](https://github.com/IonicaBizau/ssh-remote)\n\n - [`statique`](https://github.com/IonicaBizau/node-statique)\n\n - [`tinyreq`](https://github.com/IonicaBizau/tinyreq)\n\n - [`tithe`](https://github.com/IonicaBizau/tithe)\n\n - [`web-term`](https://github.com/IonicaBizau/web-term)\n\n - [`wrabbit`](https://github.com/jillix/wrabbit) by jillix\n\n## License\n\n[MIT][license] © [Ionică Bizău][website]\n\n[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW\n[donate-now]: http://i.imgur.com/6cMbHOC.png\n\n[license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(http%3A%2F%2Fionicabizau.net)&year=2015#license-mit\n[website]: http://ionicabizau.net\n[contributing]: /CONTRIBUTING.md\n[docs]: /DOCUMENTATION.md",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+ssh://git@github.com/IonicaBizau/node-clp.git"
  },
  "scripts": {
    "test": "node test"
  },
  "version": "3.2.1"
}
