{"_id":"gitlike-cli","_rev":"2893003","name":"gitlike-cli","description":"A git-like CLI library","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"time":{"modified":"2022-11-28T08:50:59.000Z","created":"2013-06-03T06:50:41.288Z","0.1.0":"2014-07-05T15:26:58.636Z","0.0.10":"2013-07-08T04:58:15.352Z","0.0.9":"2013-06-09T23:52:09.017Z","0.0.8":"2013-06-08T04:16:12.072Z","0.0.7":"2013-06-06T15:53:55.086Z","0.0.6":"2013-06-06T05:41:11.486Z","0.0.5":"2013-06-05T07:38:35.817Z","0.0.4":"2013-06-05T03:57:37.435Z","0.0.3":"2013-06-03T18:10:57.295Z","0.0.2":"2013-06-03T07:03:59.106Z","0.0.1":"2013-06-03T06:50:41.288Z"},"users":{},"author":{"name":"Jed Hunsaker"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"versions":{"0.1.0":{"name":"gitlike-cli","version":"0.1.0","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":{"url":"https://github.com/jedhunsaker/gitlike-cli/issues"},"license":"MIT","devDependencies":{"chai":"^1.9.1","mocha":"^1.20.1","sinon":"^1.10.2"},"homepage":"https://github.com/jedhunsaker/gitlike-cli","_id":"gitlike-cli@0.1.0","_shasum":"46205870a6747126f1c8546fa1d47d5fb062c99d","_from":"https://github.com/jedmao/gitlike-cli/archive/v0.1.0.tar.gz","_resolved":"https://github.com/jedmao/gitlike-cli/archive/v0.1.0.tar.gz","_npmVersion":"1.4.9","_npmUser":{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"dist":{"shasum":"46205870a6747126f1c8546fa1d47d5fb062c99d","size":14069,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.1.0.tgz"},"publish_time":1404574018636,"_hasShrinkwrap":false,"_cnpm_publish_time":1404574018636,"_cnpmcore_publish_time":"2021-12-17T13:55:52.762Z"},"0.0.10":{"name":"gitlike-cli","version":"0.0.10","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":{"url":"https://github.com/jedhunsaker/gitlike-cli/issues"},"license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.10","dist":{"shasum":"e96d1f6aa7752975fb2142bb513d024ae8f7e670","size":9816,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.10.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.10.tgz"},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1373259495352,"_hasShrinkwrap":false,"_cnpm_publish_time":1373259495352,"_cnpmcore_publish_time":"2021-12-17T13:55:53.379Z"},"0.0.9":{"name":"gitlike-cli","version":"0.0.9","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":{"url":"https://github.com/jedhunsaker/gitlike-cli/issues"},"license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.9","dist":{"shasum":"1b2005a98ae41f067138c2cc9baddde4b3715a10","size":9793,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.9.tgz"},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370821929017,"_hasShrinkwrap":false,"_cnpm_publish_time":1370821929017,"_cnpmcore_publish_time":"2021-12-17T13:55:53.600Z"},"0.0.8":{"name":"gitlike-cli","version":"0.0.8","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.8","dist":{"shasum":"39fe42e016f0ce8742005a286bb315f79e6bf703","size":9857,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.8.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370664972072,"_hasShrinkwrap":false,"_cnpm_publish_time":1370664972072,"_cnpmcore_publish_time":"2021-12-17T13:55:53.842Z"},"0.0.7":{"name":"gitlike-cli","version":"0.0.7","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"_id":"gitlike-cli@0.0.7","dist":{"shasum":"f8fbabed4e3ffc6b3fbc483ceda390d3a3b55c8e","size":5392,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.7.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370534035086,"_hasShrinkwrap":false,"_cnpm_publish_time":1370534035086,"_cnpmcore_publish_time":"2021-12-17T13:55:54.037Z"},"0.0.6":{"name":"gitlike-cli","version":"0.0.6","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.6","dist":{"shasum":"a99c537dd8c1aac608b2bfdc01773d86c3d2ba79","size":9816,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.6.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370497271486,"_hasShrinkwrap":false,"_cnpm_publish_time":1370497271486,"_cnpmcore_publish_time":"2021-12-17T13:55:54.253Z"},"0.0.5":{"name":"gitlike-cli","version":"0.0.5","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.5","dist":{"shasum":"5a5103a178da29f862f3e668edeb9137f6d1973e","size":9109,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.5.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370417915817,"_hasShrinkwrap":false,"_cnpm_publish_time":1370417915817,"_cnpmcore_publish_time":"2021-12-17T13:55:54.458Z"},"0.0.4":{"name":"gitlike-cli","version":"0.0.4","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.4","dist":{"shasum":"9500b62391e21126da0da8909005bff78208f277","size":8862,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.4.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370404657435,"_hasShrinkwrap":false,"_cnpm_publish_time":1370404657435,"_cnpmcore_publish_time":"2021-12-17T13:55:54.675Z"},"0.0.3":{"name":"gitlike-cli","version":"0.0.3","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.3","dist":{"shasum":"e8d18b62745a496d791e3681ec8462e5bd009968","size":12959,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.3.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370283057295,"_hasShrinkwrap":false,"_cnpm_publish_time":1370283057295,"_cnpmcore_publish_time":"2021-12-17T13:55:54.939Z"},"0.0.2":{"name":"gitlike-cli","version":"0.0.2","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.2","dist":{"shasum":"ed87a72dccc64cd7bcfab862c4bbc68421cc9638","size":12875,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370243039106,"_hasShrinkwrap":false,"_cnpm_publish_time":1370243039106,"_cnpmcore_publish_time":"2021-12-17T13:55:55.218Z"},"0.0.1":{"name":"gitlike-cli","version":"0.0.1","description":"A git-like CLI library","keywords":["git","cli"],"author":{"name":"Jed Hunsaker"},"contributors":[{"name":"Jed Hunsaker","email":"jed.hunsaker[at]gmail.com"}],"main":"index.js","directories":{"lib":"./lib"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/jedhunsaker/gitlike-cli.git"},"bugs":"https://github.com/jedhunsaker/gitlike-cli/issues","license":"MIT","devDependencies":{"chai":"~1.6.0","mocha":"~1.10.0","sinon":"~1.7.2"},"readmeFilename":"README.md","_id":"gitlike-cli@0.0.1","dist":{"shasum":"fabc68c8a3a526317bae1f3329cba438a40b925b","size":12866,"noattachment":false,"key":"/gitlike-cli/-/gitlike-cli-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/gitlike-cli/download/gitlike-cli-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"jedhunsaker","email":"jed.hunsaker@gmail.com"},"maintainers":[{"name":"jedmao","email":"jed.hunsaker+npm@gmail.com"}],"publish_time":1370242241288,"_hasShrinkwrap":false,"_cnpm_publish_time":1370242241288,"_cnpmcore_publish_time":"2021-12-17T13:55:55.509Z"}},"readme":"# Git-like CLI\n\nA git-like [CLI][] for [Node.js][] command-line interfaces, inspired by\n[tjholowaychuk's][] [commander][], meant to give you the flexibility and power\nakin to the [git command and its sub-commands][] (e.g., [git commit][]).\n\nWith Git-like CLI, you can create sub-commands as deep as you want.\n\nPerhaps unique to Git-like CLI, you can easily create crazy argument\ncombinations, mixing required, optional, required-repeating and\noptional-repeating arguments to your liking, as long as they aren't\nambiguous.\n\nWhat you won't find in Git-like CLI are some [commander][] features, such\nas prompts, password masking, confirm and choose. If you need these features,\n[commander][] is highly recommended.\n\n[![Build Status][]](http://travis-ci.org/jedmao/gitlike-cli)\n\n\n## Installation\n\n    $ npm install gitlike-cli\n\n\n## Getting Started\n\n```js\nvar program = require('gitlike-cli');\nprogram.parse(process.argv);\n```\n\nThe above example is a program that really does nothing at all; however, enough\ninformation is provided to generate some basic help information.\n\n```\n$ foo --help\n\n  Usage: foo [options]\n\n  Options:\n\n    -h, --help  output help information\n```\n\nThe help information is auto-generated based on the information the CLI\nalready knows about your program. Auto-generated help information will also\nbe added for any custom options you define for your application. Adding a\nversion will have the same effect.\n\n```js\nprogram\n    .version('0.1.2')\n    .parse(process.argv);\n```\n\nProduces the following options:\n\n```\n    -h, --help     output help information\n    -V, --version  output version information\n```\n\nYou can output help or version information from code by calling the respective\n`.help(die)` or `.version(die)` methods. The `die` argument, if true, will\nsimply call `process.exit()` for you.\n\n\n## Usage\n\nProviding usage information gives the CLI more information about how your\nprogram can be used.\n\n```js\nprogram.usage('foo <bar>');\n```\n\nThis tells the CLI that your command is named `foo` and requires a single\nargument, named `<bar>`. The chevrons around `bar` designate `<bar>` as a\nrequired argument. If `<bar>` is not provided, the help information will\nautomatically display.\n\nCalling the usage method without any arguments will display the generated\nusage information.\n\n```js\nprogram.usage('foo <bar>').usage();\n```\n\nProduces the following:\n\n```\n  Usage: foo [options] <bar>\n```\n\n\n## Arguments\n\nThere are four different types of arguments you can supply.\n\n1. Required: `<arg>`\n1. Required, repeating: `<args>...`\n1. Optional: `[arg]`\n1. Optional, repeating: `[<args>...]`\n\nYou can combine any number of arguments you want; however, be aware that some\ncombinations are ambiguous and will throw an error. There are only two\nscenarios for this to happen. These errors will be thrown when you provide\nusage information:\n\n1. CommandError: Cannot have more than one repeating arg.\n1. CommandError: Cannot have an optional arg after a repeating arg.\n\nIf no errors are thrown, the CLI moves onto the parsing stage. When arguments\nare parsed, they will be stored in the program's `args` property. For example,\nif the argument is named `<bar>`, like above, calling `$ foo qux` will store\nthe string `qux` in `program.args.bar`.\n\nRepeating arguments will be stored as arrays.\n\nUnconsumed arguments will be stored in `program.args.etc` as an array.\n\nYou now need to understand how multiple arguments are parsed:\n\n1. Arguments will be parsed from left to right, always.\n1. Required args will never be skipped and will throw errors if not enough\n   args are supplied to fulfill the total number of required args.\n1. Optional args will only be skipped if there are not enough args supplied to\n   fill them.\n1. A repeating arg will consume as many args as it can, but will reserve slots\n   for any required arguments that follow.\n\nExample usage: `[<foo>...] <bar> <baz>`\n\n+ Parsing `x y` produces `{bar:'x', baz:'y'}`\n+ Parsing `a b c x y` produces `{foo:['a','b','c'], bar:'x', baz:'y'}`\n\nExample usage: `[foo] [bar] <baz>`\n\n+ Parsing `x` produces `{baz:'x'}`\n+ Parsing `x y` produces `{foo:'x', baz:'y'}`\n+ Parsing `x y z` produces `{foo:'x', bar:'y', baz:'z'}`\n\n\n## Options\n\nOptions are defined with the `.option()` method, also serving as documentation\nfor the options. The example below parses args and options from `process.argv`.\n\n```js\nprogram\n    .option('-p, --peppers', 'Add peppers')\n    .option('-P, --pineapple', 'Add pineapple')\n    .option('-b, --bbq', 'Add bbq sauce')\n    .option('-c, --cheese <type>', 'Add the specified type of cheese [marble]', 'marble')\n    .option('-C, --no-cheese', 'You do not want any cheese')\n    .parse(process.argv);\n\nvar options = program.options;\nconsole.log('you ordered a pizza with:');\nif (options.peppers) console.log('  - peppers');\nif (options.pineapple) console.log('  - pineapple');\nif (options.bbq) console.log('  - bbq');\nconsole.log('  - %s cheese', options.cheese || 'no');\n```\n\nOptions can have `[optional]` or `<required>` arguments attached to them, but\nnot `<repeating>...` arguments.\n\nShort flags may be passed as a single arg, for example `-abc` is equivalent to\n`-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased,\nbecoming `program.options.templateEngine`.\n\nShort combo flags with multiple args follow the same rules for parsing as do\narguments. For example, if `-abc` flags all have args attached to them, then\n`-abc foo bar baz` will assign the appropriate values, from left to right.\n\nOptional args, again, follow the same rules as command args. This differs from\ngit's CLI, but in a good way. Sure, `git commit -am \"stuff\"` parses `-m` as\n`\"stuff\"`, but `git commit -ma \"stuff\"` throws an error. Git-like CLI, knowing\nthat `-m` has a required `<msg>` argument and `-a` has no argument at all, is\nsmart enough to parse this command gracefully and without errors.\n\n\n## Coercion\n\nGit-like CLI uses `JSON.parse()` to parse values. This means you can parse\nintegers, floats, booleans, arrays and even JSON objects out of the box.\nFurthermore, you can pass a callback function as an additional option argument\nif you need more custom control over the result.\n\n```js\nfunction range(val) {\n  return val.split('..').map(Number) || [];\n}\n\nfunction list(val) {\n  return val.split(',');\n}\n\nfunction square(val) {\n  return val * val;\n}\n\nprogram\n  .usage('<files>...')\n  .option('-s, --square <x>', 'A square of x', square)\n  .option('-r, --range <a>..<b>', 'A range', range)\n  .option('-l, --list <items>', 'A list', list)\n  .option('-o, --optional [value]', 'An optional value')\n  .parse(process.argv);\n\nvar options = program.options;\nconsole.log(' options.square: %j', options.square);\noptions.range = options.range || [];\nconsole.log(' options.range: %j..%j', options.range[0], options.range[1]);\nconsole.log(' options.list: %j', options.list);\nconsole.log(' options.optional: %j', options.optional);\nconsole.log(' args.files: %j', program.args.files);\n```\n\n## Custom help\n\nYou can display arbitrary `-h, --help` information by listening for \"help\".\nThe program will automatically exit once you are done so that the remainder of\nyour program does not execute causing undesired behaviours. For example, in the\nfollowing executable \"stuff\" will not output when `help` is used.\n\n```js\nvar program = require('../');\n\nfunction list(val) {\n  return val.split(',').map(Number);\n}\n\nprogram\n  .version('0.0.1')\n  .option('-f, --foo', 'enable some foo')\n  .option('-b, --bar', 'enable some bar')\n  .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('help', function(){\n  console.log('  Examples:');\n  console.log();\n  console.log('    $ custom-help --help');\n  console.log('    $ custom-help -h');\n  console.log();\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n  -h, --help     output usage information\n  -V, --version  output the version number\n  -f, --foo      enable some foo\n  -b, --bar      enable some bar\n  -B, --baz      enable some baz\n\nExamples:\n\n  $ custom-help --help\n  $ custom-help -h\n\n```\n\n## Error Handling\n\nThe base command for your program already has some error handling built-in.\nIf you decide, however, that you want more control over the errors emitted,\nsimply handle the `error` event in your code. In the example below, the error\nmessage is printed in red. Everything else is exactly what you would see in\nGit-like CLI's built-in error handling.\n\n```js\nvar clc = require('cli-color');\n\nprogram.on('error', function(err, command){\n    console.log('');\n    console.log(clc.red('  Error:', err.message));\n    command.outputUsage();\n    command.outputCommands();\n    command.outputOptions();\n    console.log();\n    process.exit(1);\n});\n\nprogram.parse(process.argv);\n```\n\nIMPORTANT: Make absolutely sure that your error handler comes _before_\n`program.parse(process.argv)`. Even better, though totally up to you, put it\nbefore defining your version, description or any other program information.\nThis allows errors in your own code to present themself through your custom\nerror handler as well.\n\nThe final `process.exit(1);` tells node to exit the program immediately with\nan error code (any non-zero integer). Your error handler will always be called\nbefore Git-like CLI's built-in error handler, so this gives you an opportunity\nto do your own thing and stump the program from doing anything after the fact.\n\nYou might have noticed a few undocumented methods above (i.e., outputUsage,\noutputCommands and outputOptions). Their names are quite self-explanatory, so\nI trust you know what they do.\n\nYou _could_ just output the error message itself and bypass all the usage\ninformation. The output would then look something like this:\n\n```\n$ ./bin/program foo\n\n  Error: Invalid sub-command: foo\n```\n\nAny unhandled errors will not emit an error event, so it will be pretty ugly.\nPlease report any issues like this in the [Issue Tracker][].\n\n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright (c) <2013> Jed Hunsaker\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n\n[CLI]: http://en.wikipedia.org/wiki/Command-line_interface\n[node.js]: http://nodejs.org\n[tjholowaychuk's]: https://npmjs.org/~tjholowaychuk\n[commander]: https://npmjs.org/package/commander\n[git command and its sub-commands]: http://git-scm.com/docs\n[git commit]: http://git-scm.com/docs/git-commit\n[Build Status]: https://secure.travis-ci.org/jedmao/gitlike-cli.png\n[Issue Tracker]: https://github.com/jedhunsaker/gitlike-cli/issues\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/jedmao/gitlike-cli/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","_attachments":{},"homepage":"https://github.com/jedhunsaker/gitlike-cli","bugs":{"url":"https://github.com/jedhunsaker/gitlike-cli/issues"},"license":"MIT"}