{"name":"bossy","description":"Command line options parser","version":"1.0.2","repository":{"type":"git","url":"git://github.com/hapijs/bossy"},"main":"index","keywords":["cli","command line","options","parser"],"engines":{"node":">=0.10.30"},"dependencies":{"hoek":"2.x.x"},"devDependencies":{"lab":"4.x.x"},"scripts":{"test":"make test-cov"},"licenses":[{"type":"BSD","url":"http://github.com/hapijs/bossy/raw/master/LICENSE"}],"contributors":[{"name":"Eran Hammer","email":"eran@hammer.io","url":"http://hueniverse.com"},{"name":"Wyatt Preul","email":"wpreul@gmail.com","url":"http://jsgeek.com"}],"gitHead":"92c6a6723877aca7f3eabc9a4bbab3d1af7f7eda","bugs":{"url":"https://github.com/hapijs/bossy/issues"},"homepage":"https://github.com/hapijs/bossy","_id":"bossy@1.0.2","_shasum":"07d7191cd6607a329402823cc72b8f3349cbe827","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"wyatt","email":"wpreul@gmail.com"},"maintainers":[{"name":"wyatt","email":"wpreul@gmail.com"},{"name":"arb","email":"arbretz@gmail.com"}],"dist":{"shasum":"07d7191cd6607a329402823cc72b8f3349cbe827","tarball":"http://registry-npm.ywwl.com/bossy/download/bossy-1.0.2.tgz","integrity":"sha512-Y5pZnyL66WVXwOWJp8SOf/c0N7ZkH8NopjpHDl9rj5XXRAJ9SYUr4fY/18OsMeO4wGbZ/HEs7bwi8Ztw8NRRcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPJfJ3Qt1nfd/5IiKXPVGatC4ta8aGxru9Zv08zsdKfwIhAOQ54NgJpy2+S3kup5ntgB64F9B/NOuxJhk5YD5aQwuT"}],"size":7923,"noattachment":false,"key":"/bossy/-/bossy-1.0.2.tgz"},"directories":{},"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":1410807568739,"_cnpm_publish_time":1410807568739,"dist-tags":{"latest":"4.0.3"}}