{"name":"bossy","description":"Command line options parser","version":"4.0.2","repository":{"type":"git","url":"git://github.com/hapijs/bossy.git"},"main":"lib/index.js","keywords":["cli","command line","options","parser"],"engines":{"node":">=8.12.0"},"dependencies":{"boom":"7.x.x","hoek":"5.x.x","joi":"14.x.x"},"devDependencies":{"code":"5.x.x","lab":"17.x.x"},"scripts":{"test":"lab -a code -t 100 -L","test-cov-html":"lab -a code -r html -o coverage.html"},"license":"BSD-3-Clause","gitHead":"b51f97de7ed810726b15b3abaca78b56161b25ea","bugs":{"url":"https://github.com/hapijs/bossy/issues"},"homepage":"https://github.com/hapijs/bossy#readme","_id":"bossy@4.0.2","_npmVersion":"6.4.1","_nodeVersion":"11.0.0","_npmUser":{"name":"hueniverse","email":"eran@hammer.io"},"dist":{"integrity":"sha512-FkMsGa4P7SNod3K1qlNKs5R+cN/EowJNvqqgN0V10gfWSsMBSU0gjJt9N8ty0JAE/wnxhj4oFxWazqAuIw0yNQ==","shasum":"e37dfe45082d3ce4d20d41332b40b2a67e3fe9b2","tarball":"http://registry-npm.ywwl.com/bossy/download/bossy-4.0.2.tgz","fileCount":6,"unpackedSize":15483,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2ThrCRA9TVsSAnZWagAA6gQP/iI3fZu7jecziaD3keY7\nbQHd7vo+bXcW02nKXdaB+7NpiT49ho5rvDVwZoapQNyDhghYFnK1pE9FiOgU\nIEZcTwLSbcnGsdNn7A4u2lcl3LJMJnz8LwrOl2flfwDdlDGzEQNNVSvJDa8j\nUyPXPxgJHQjjXQcDzI24p/TG256zKPI+bpEFRLIYSinJbQ0kAh7A5GnVlb0n\nO8mb45+X0tT4AQGEb73wUG0jLmxy0gMO9VD1pFWPVeGnGK0Gt+Y5HHHu9AlN\ny7oB1z4u1bmBpTJWdBRXSUmaxVy1a20OMKvYZkafBsxzm4Wz2eNbiiaeIlvb\niP4wiExUh3JGp+XPrBzVSd1TsvVSzWK/KoOaIqb5rXafJt3f9QZHlB+HLvoD\nOg3cV/WKTEnGjrdi3XumVuWjxwntKinfD6dLi3TMkDwp/p2YudwKzbVsbpOV\nvR3ygOfZVNu+YxDgrwfO3UN34RbHm78BPM39KHJWEf8H799aOiwGt8t5xoJg\nWtHjyBscKIehH80BXEV4ya9IqQzlbEa8fhUGiFu8RSAGhC0gzJbMHbvJD+lm\nHd62GEPJlkoFIfeXE9cCp8FQY0vcETjbCdDYr/igNxYTvlzg9Zq3JyCir87s\nXYW6S3ZckkG68+9ZBWvGI6FMZlw1kyoNUfjU5fzVqkYCYmXJG5xrI5/obBka\nMlJk\r\n=hMH1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnT9jt5mAjI/Ut/YMNgofziByt+9yg3ciU628GS47CuwIgTN402YJvv8EkfmLMPkrQg1Bmv0LIKENbSL/078uHPtw="}],"size":4998,"noattachment":false,"key":"/bossy/-/bossy-4.0.2.tgz"},"maintainers":[{"name":"arb","email":"arbretz@gmail.com"},{"name":"hueniverse","email":"eran@hammer.io"},{"name":"sericaia","email":"alunassertiva@gmail.com"},{"name":"wyatt","email":"wpreul@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bossy_4.0.2_1540962410729_0.8797292616961923"},"_hasShrinkwrap":false,"deprecated":"This module has moved and is now available at @hapi/bossy. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.","readme":"# bossy\r\n\r\nCommand line options parser.\r\n\r\n[![Build Status](https://secure.travis-ci.org/hapijs/bossy.png)](http://travis-ci.org/hapijs/bossy)\r\n\r\nLead Maintainer - [Eran Hammer](https://github.com/hueniverse)\r\n\r\n\r\n## Usage\r\n\r\n```js\r\nvar Bossy = require('bossy');\r\n\r\nvar definition = {\r\n    h: {\r\n        description: 'Show help',\r\n        alias: 'help',\r\n        type: 'boolean'\r\n    },\r\n    n: {\r\n        description: 'Show your name',\r\n        alias: 'name'\r\n    }\r\n};\r\n\r\n\r\nvar args = Bossy.parse(definition);\r\n\r\nif (args instanceof Error) {\r\n    console.error(args.message);\r\n    return;\r\n}\r\n\r\nif (args.h || !args.n) {\r\n    console.log(Bossy.usage(definition, 'hello -n <name>'));\r\n    return;\r\n}\r\n\r\nconsole.log('Hello ' + args.n);\r\nconsole.log('Hello ' + args.name);\r\n```\r\n\r\n## Methods\r\n\r\n### `parse(definition, [options])`\r\n\r\nExpects a *bossy* definition object and will return the parsed `process.argv` arguments provided.  If there is an error\r\nthen the return value will be an `instanceof Error`.\r\n\r\nOptions accepts the following keys:\r\n* `argv` - custom argv array value.  Defaults to process.argv.\r\n\r\n### `usage(definition, [usage], [options])`\r\n\r\nFormat a  *bossy* definition object for display in the console.  If `usage` is provided the returned value will\r\ninclude the usage value formatted at the top of the message.\r\n\r\nOptions accepts the following keys:\r\n* `colors` - Determines if colors are enabled when formatting usage.  Defaults to whatever TTY supports.\r\n\r\n\r\n## Definition Object\r\n\r\nThe definition object should be structured with each object key representing the short form of an available command\r\nline argument.  Each argument key supports the following properties:\r\n\r\n* `alias`: A string or array of strings that can also be used as the argument name.  For example:\r\n```\r\nh: {\r\n    alias: 'help'\r\n}\r\n```\r\n\r\n* `type`: Available types are: `boolean`, `range`, `number`, `string`, and `help`.  Defaults to `string`.\r\n\r\n    `help` is a special type that allows the switch to be executed even though\r\n    other paramters are required. Use case is to display a help message and\r\n    quit. This will bypass all other errors, so be sure to capture it. It\r\n    behaves like a `boolean`.\r\n\r\n* `multiple` : Boolean to indicate if the same argument can be provided multiple times. If true, the parsed value\r\nwill always be an array of `type`'s. Defaults to `false`.\r\n\r\n* `description`: Description message that will be returned with usage information.\r\n\r\n* `require`: Boolean to indicate if the argument is required.  Defaults to `false`\r\n\r\n* `default`: A default value to assign to the argument if its not provided as an argument.\r\n\r\n* `valid`: A value or array of values that the argument is allowed to equal.\r\n","publish_time":1540962410855,"_cnpm_publish_time":1540962410855,"dist-tags":{"latest":"4.0.3"}}