{"_id":"option-parser","_rev":"11-2d823d90d1cb2745818f76c18b79405e","name":"option-parser","description":"Command-line option parser similar to getopt","dist-tags":{"latest":"1.0.2"},"versions":{"0.1.2":{"name":"option-parser","version":"0.1.2","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"description":"Command-line option parser similar to getopt","homepage":"https://github.com/tests-always-included/option-parser/","contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com/"}],"main":"./nodejs/OptionParser.js","repository":{"type":"git","url":"https://github.com/tests-always-included/option-parser.git"},"keywords":["command-line","command","line","option","parser","flag","flags","getopt"],"dependencies":{},"devDependencies":{},"license":"MIT","engines":{"node":">=0.6","npm":"~1"},"scripts":{"test":"cd tests && node nodejs.js"},"gitHead":"38311443f72abdacfedba9244d0a37f0c838a1b3","bugs":{"url":"https://github.com/tests-always-included/option-parser/issues"},"_id":"option-parser@0.1.2","_shasum":"2afe1f9e8aeaa9daa2e4324fc46f8f4b530ebcdf","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"dist":{"shasum":"2afe1f9e8aeaa9daa2e4324fc46f8f4b530ebcdf","tarball":"https://registry.npmjs.org/option-parser/-/option-parser-0.1.2.tgz","integrity":"sha512-yfJhJ2nh+BcEi8W+5FLc+FIbGiq7gnO2HA1H4nSPV7uS4WGlgkIukMHqC50ZwwpjP7TvLsYk+u9x1eNtRq1UOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDblMJA6ULDvDcBWRkO53KD6gCu+OsjL5+jNt5PmjUPfgIhANQepIDt6hpL1QPgDS1ccMOb2rTWzbrGZJfMwrIPUHVG"}]},"directories":{}},"0.1.3":{"name":"option-parser","version":"0.1.3","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"description":"Command-line option parser similar to getopt","homepage":"https://github.com/tests-always-included/option-parser/","contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com/"}],"main":"./lib/option-parser.js","repository":{"type":"git","url":"https://github.com/tests-always-included/option-parser.git"},"keywords":["command-line","command","line","option","parser","flag","flags","getopt"],"dependencies":{},"devDependencies":{},"license":"MIT","engines":{"node":">=0.6","npm":"~1"},"scripts":{"test":"test/run-tests"},"gitHead":"8de37b2a4f6dbb9f906db19a39b2364b60573347","bugs":{"url":"https://github.com/tests-always-included/option-parser/issues"},"_id":"option-parser@0.1.3","_shasum":"cfe33c0fe95f805d9c0ac79e91224bbfa26a9c17","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"dist":{"shasum":"cfe33c0fe95f805d9c0ac79e91224bbfa26a9c17","tarball":"https://registry.npmjs.org/option-parser/-/option-parser-0.1.3.tgz","integrity":"sha512-e0cuc/LIcKcx6ILYfwrrblH6R12Q/XFqvuXaogmRQjcVptxFVfYWGAFUZP8KDkLetdL9eiVneFm8VCg1xH12Fg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE1VbVENPPwHG4itIk2G+9LIYQU9qnzVxasFrQe4/iNfAiA8sI6fTkiWQyEzu8pt2LzpKWld6gtsxS9qv0ye8RVE8A=="}]},"directories":{}},"1.0.0":{"name":"option-parser","version":"1.0.0","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"description":"Command-line option parser similar to getopt","homepage":"https://github.com/tests-always-included/option-parser/","contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com/"}],"main":"./lib/option-parser.js","repository":{"type":"git","url":"git+https://github.com/tests-always-included/option-parser.git"},"keywords":["command-line","command","line","option","parser","flag","flags","getopt"],"dependencies":{},"devDependencies":{},"license":"MIT","engines":{"node":">=0.6","npm":"~1"},"scripts":{"test":"test/run-tests"},"gitHead":"5761ac615cc019f1335acd952e2ed434de382332","bugs":{"url":"https://github.com/tests-always-included/option-parser/issues"},"_id":"option-parser@1.0.0","_shasum":"9d470f969b7cb0cd2bb5b75e998be9961ba57206","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"dist":{"shasum":"9d470f969b7cb0cd2bb5b75e998be9961ba57206","tarball":"https://registry.npmjs.org/option-parser/-/option-parser-1.0.0.tgz","integrity":"sha512-cAsgWzqlQGjzcfauAQP/ZweJf7+NS41+rWYZsJsWYGa8JCmH9ntZWK1k0xDFetoRW6YVilpZiKyJNs0V2A2Idg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWNaGFc5e9SWMu1LZC4RJbEdmVkTgOZMdANwXduLJrzAIhAPpQLt4pxWM/z47VT/1C3iHnl4dhYjZLevp03wOgX6/K"}]},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/option-parser-1.0.0.tgz_1484087398094_0.47728842683136463"},"directories":{}},"1.0.1":{"name":"option-parser","version":"1.0.1","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"description":"Command-line option parser similar to getopt","homepage":"https://github.com/tests-always-included/option-parser/","contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com/"}],"main":"./lib/option-parser.js","repository":{"type":"git","url":"git+https://github.com/tests-always-included/option-parser.git"},"keywords":["command-line","command","line","option","parser","flag","flags","getopt"],"license":"MIT","scripts":{"test":"test/run-tests"},"gitHead":"3b057d359a4287bd35fa7706e9623e78a10fef2f","bugs":{"url":"https://github.com/tests-always-included/option-parser/issues"},"_id":"option-parser@1.0.1","_nodeVersion":"12.14.1","_npmVersion":"7.7.4","dist":{"integrity":"sha512-uB8FjtBTTSF317RVCV1gsC72dJ610BlpmlAUaRxMkEOtwzC0uUVlv2mphFD3MSJcLFf7q3Z35tknqEUcbMJd+w==","shasum":"a518f3bf539611763971290690d1c6945724b71e","tarball":"https://registry.npmjs.org/option-parser/-/option-parser-1.0.1.tgz","fileCount":29,"unpackedSize":48346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/ZOECRA9TVsSAnZWagAAItwP/07AUCgX8YLC8UbTxaEA\nop7S5zCwrcJlJ43T8KMqNw3VrYtTQ0jClepETZwSAmLxkJd0P5BAVnsQxLaO\njwJyUsqWHNy8BuoobubCdFgG8SPV/T49ldXPzZtTF0/ZM9R5im5iKaPmD1Sb\ncJe1nd5pxc9YK5VUpJOXjReapKsFhGpdxR/ELVZ4QgxA2wBDdeaS7DDqH2K5\n47Ko4q5BERRTVrtDyEtNxJNVdOWFTG4Tu1i4ukxfNFLZR7ATT0HLvjS4oT19\nf/mpv8eW8wn1iJfnEk2pc4V21h/qhhBzuAGKCHMHSIirIaZqk3SlnwRlNwVB\nAP/Jnc5XzgO97v/4gRX2XMHNWQF2NVfizj8qWNKWpfQXZ7P+ky2GBTQpHteh\nLo7qFdfCMMCdH0xgp6Li+yiIGVmKEaXPZuyoTs4jFXP9Phn/ou/1H7WEVNUf\n1ED412uuqCEo5a+iA2m5hxk4f9hOaoM9IzcCl2FRe0KJfn2HdmjRJ6JNp8l1\nAVUv6v897gXPeKi7FpZkknbobYLcd8g31fQQVOi+anhngSbKAVziHePX1BqU\nIQP9cxRv1dERMHBip0KM086LRH8tMrbLRJl6PcwV47W1rvbfisyv+dP34THr\nDJQCLeG3bIaexycVBrLjWnUk+Sdkio6leNt1KPuaQTfIvYea3ABP6bTQXTow\nU85M\r\n=H3jO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIErVfkaKSWkU/oN/p2Dx8ceoVK740CUZZceDqUSUm9gIgfJy7JSXbCetTYjxr1T8mQFAIcqwZ8dZgjQst481OHgM="}]},"_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"directories":{},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/option-parser_1.0.1_1627231108128_0.1820713768880804"},"_hasShrinkwrap":false},"1.0.2":{"name":"option-parser","version":"1.0.2","author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"description":"Command-line option parser similar to getopt","homepage":"https://github.com/tests-always-included/option-parser/","contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com/"}],"main":"./lib/option-parser.js","repository":{"type":"git","url":"git+https://github.com/tests-always-included/option-parser.git"},"keywords":["command-line","command","line","option","parser","flag","flags","getopt"],"license":"MIT","scripts":{"test":"test/run-tests"},"gitHead":"dc0e54051de8c4e7ebcc47fc5e11af6fb4f721af","bugs":{"url":"https://github.com/tests-always-included/option-parser/issues"},"_id":"option-parser@1.0.2","_nodeVersion":"16.7.0","_npmVersion":"7.20.3","dist":{"integrity":"sha512-Q56FmRi6TZX+S9jAl9f0Tnrk7W8faAZULf6Y0IgJR6Cy7/MxhzvBFoyL1Sz2DD7WbOY2Fxtkz2S/3kzlbn/VsQ==","shasum":"f2b872f5dfb0bb84f082ad1103e978a1152f70dc","tarball":"https://registry.npmjs.org/option-parser/-/option-parser-1.0.2.tgz","fileCount":29,"unpackedSize":48346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJt90CRA9TVsSAnZWagAANmUP/Aj2Lq6PzKOQ6yoe4mXn\nnJqLOBRxrzkE6nHItguuk5pM3DQwzrfa/uS+Gas/GWyuJBvP68qmhpMN/iZA\noPF2Sl5KiQjZzMVRHZ5FsQsUY5F7aIrwUMfIJcUYDCXJ5TxFp9KEN3p1o4w7\nMjgvkBpguUtdaULptWAjiogD6lYsZMAnbbK8CFf24QcB/9EW8Wh0N2IVaNwY\nr7+KVw6ybcJXy1k1Lv5NbOJ65LH+0TBAz09cztOcRwv/ZB9R/HpEQn7RHvAm\nDeFkH4GNidsr9n1M/cR2mYwyXAKrvMncjfsUrSHginvlEMph7tLsN7eH2ozR\niO/3GeBvN4PiEhGzNEu+/ckPThY3W7ihqDu2fd2WeiSJVkfyok/ks8M7LmU5\nLFYPRONopHVKLZaXPCJnfekTI1RTljQT85QS9xuaaFgcPCm7/LlzViVZ8i/3\nvQhYR3gc7n+v3qfSgJ+TLiCLTLg8Ye1sbhQeqWLlAxkO90bBZxeDmH0asfUf\nU6lfUGGjusRkEH5HHwd+3HevNIKd4VLOXC2nyqu7JR4P0zwXG0/5vz/dLOgn\nxA/P3R5vLH+hYXoIVccrLYrRyo4NkjMwtk43BZK4O6qbGA6EaxDkjqJAfD7g\n3e8glqslTKGO8O7+RDFXsL5yuR4dhE+OOaUvlLS9jvDWxRHmxGox51N66Hbv\nyWo2\r\n=imss\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWLzbgWO6yiwhRMBEqHoWXQtGkaNCwXX5e958ZsYDdewIhAOV9GaV7uNWTDTNiR9ZsRuuhPcLTOH5Yojb/PSeYac9C"}]},"_npmUser":{"name":"fidian","email":"fidian@rumkin.com"},"directories":{},"maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/option-parser_1.0.2_1629937523957_0.8905588697483398"},"_hasShrinkwrap":false}},"readme":"`OptionParser` - JavaScript Version\n===================================\n\n`OptionParser` is a library to help you parse command-line options, similar to how `getopt` works.  An effort is made to make it POSIX compliant and easy for people to use.  Features of many other implementations have been integrated in order to provide significant flexibility and to make it easier to use.\n\nThere is a sample parser in the [examples] directory.\n\n[![npm version][npm-badge]][npm-link]\n[![Build Status][travis-badge]][travis-link]\n[![Dependencies][dependencies-badge]][dependencies-link]\n[![Dev Dependencies][devdependencies-badge]][devdependencies-link]\n\n\nFeatures\n--------\n\n* -x (short options)\n* -xxxyxxz (combined and repeating short options)\n* --long (long option)\n* -x=Value, --long=Value (optional and required values)\n* -xValue --long Value (special format for required values)\n* -- (signify the end of options)\n* Nearly automatic help generation\n* Can stop on the first unparsed option\n* Can autocomplete long options\n* Returns unparsed options\n* Flexible option handling\n\n\nHow to use\n----------\n\nFirst, create the parser object:\n\n    OptionParser = require('option-parser');\n    parser = new OptionParser();\n\nNext, you add some options.  I'll jump right in and add the standard \"help\" option, triggered with either \"-h\" or \"--help\".\n\n    parser.addOption('h', 'help', 'Display this help message')\n        .action(parser.helpAction());\n\nFinally, parse the command line options.\n\n    parser.parse();\n\n\nHow To Use Parameters\n---------------------\n\nThe whole point of the library is to make it really easy to handle the parsing\nof options to your program.  Let's run through a few examples here:\n\n\n### Toggle a Flag With A Callback\n\nLet's have this option only work with the short option \"-f\".\n\n    flagWasSet = false;\n\n    parser.addOption('f', null, 'Toggle a flag')\n        .action(function () {\n            flagWasSet = true;\n        });\n\n\n### Pass a Required Value\n\nMany options need a specific value, such as an input file to process.  Here is another option that is specified by \"-i\" or \"--input\" that requires a filename of the input file.  It uses a callback, just like the above example.\n\n    inputFile = '/dev/stdin';\n\n    parser.addOption('i', 'input', 'Specify an input file')\n        .argument('FILE')  // You can name the argument anything you like\n        .action(function (value) {\n            inputFile = value;\n        });\n\n\n### Optional Value and Parameter Object\n\nPrefer to not use a lot of callbacks?  One alternative would be to use the returned object from setting up the option on the parser.  Here, we add a debug option that lets you set the debug level, but can default to 5 if you don't set one explicitly.\n\n    debugLevel = 0;\n\n    debugOption = parser.addOption(null, 'debug',\n         'Sets the debug level; if set, default is 5')\n        .argument('Level', false);  // See note below\n\n    // Don't forget to set up the other options here\n\n    parser.parse();\n    \n    // Now use the debugOption object to set the debug value\n    if (debugOption->count()) {\n        debugLevel = debugOption->value() || 5;  // Default to 5\n    }\n\nThe first parameter to `OptionParameter.argument()` is the name of the parameter, as seen in the generated help message.  It doesn't affect the execution of the parser in any other way.  The second parameter, `false`, makes the argument optional.\n\n`debugOption.count()` returns the number of times the argument was specified.  `debugOption.value()` returns the last value passed to the parameter.  For detailed information, check out the documentation for [OptionParameter].\n\n\n### Named Parameters\n\nKeeping references to the objects can be tedious.  Here is the above example\naltered to name the parameter and then use the named parameter.  I'm naming the\nparameter \"dddd\" to help contrast against the previous code.\n\n    debugLevel = 0;\n\n    parser.addOption(null, 'debug',\n         'Sets the debug level, default is 5', 'dddd')\n        .argument('Level', false);\n\n    // Don't forget to set up the other options here\n\n    parser.parse();\n    \n    if (parser.dddd.count()) {\n        debugLevel = parser.dddd.value();\n    }\n\n\n### Getopt\n\nLastly, PHP has a unique format for handling command-line arguments using\nthe built-in function `getopt()`.  After setting up options and calling\n`parser.parse()`, you can get back an Object that mimics `getopt()` return\nvalue.  It is ported over from the PHP version of this library to assist with testing.\n\n    // Set up options and then call parse()\n    parser.parse();\n\n    // Get back an Object of options like PHP's getopt()\n    options = parser.getopt();\n\n\nUnparsed Options\n----------------\n\nIf you plan on making a program that takes a list of files or needs to work on the options that were passed to the program but were not parsed by `OptionParser`, that's really simple:\n\n    unparsed = parser.parse();\n\nThis will contain an array of options, split out into individual options.  If you passed \"-abcd\" to your program and it handled \"-a\", \"-b\", and \"-c\", then `unparsed` would be an array that only contains \"-d\".\n\n\nMore Reading\n------------\n\nYou can read the documentation for the individual classes to understand more about what they do and how they work.\n\n* [OptionParameter]\n* [OptionParser]\n\nReference implementations are available in the [examples] directory in the repository.\n\n\nDevelopment\n-----------\n\nI would happily accept patches and suggestions.\n\nTests are *always* included.  To get them running on your system, just make sure the submodules are checked out for the repository.  If you don't have a `test/` folder then run this command:\n\n    git submodule update --init\n\nFrom there you can run the tests.  Start in the root of this repository and run this command.\n\n    test/run-tests\n\n(Using `npm test` also works well.)\n\n\n[dependencies-badge]: https://img.shields.io/david/tests-always-included/option-parser-js.svg\n[dependencies-link]: https://david-dm.org/tests-always-included/option-parser-js\n[devdependencies-badge]: https://img.shields.io/david/dev/tests-always-included/option-parser-js.svg\n[devdependencies-link]: https://david-dm.org/tests-always-included/option-parser-js#info=devDependencies\n[examples]: examples/\n[LICENSE]: LICENSE.md\n[npm-badge]: https://img.shields.io/npm/v/option-parser.svg\n[npm-link]: https://npmjs.org/package/option-parser\n[OptionParameter]: option-parameter.md\n[OptionParser]: option-parser.md\n[travis-badge]: https://img.shields.io/travis/tests-always-included/option-parser-js/master.svg\n[travis-link]: http://travis-ci.org/tests-always-included/option-parser-js\n","maintainers":[{"name":"fidian","email":"fidian@rumkin.com"}],"time":{"modified":"2022-06-23T01:18:09.496Z","created":"2014-09-20T23:00:11.679Z","0.1.2":"2014-09-20T23:00:11.679Z","0.1.3":"2014-09-21T23:22:33.553Z","1.0.0":"2017-01-10T22:29:58.758Z","1.0.1":"2021-07-25T16:38:28.462Z","1.0.2":"2021-08-26T00:25:24.096Z"},"homepage":"https://github.com/tests-always-included/option-parser/","keywords":["command-line","command","line","option","parser","flag","flags","getopt"],"repository":{"type":"git","url":"git+https://github.com/tests-always-included/option-parser.git"},"contributors":[{"name":"Tyler Akins","email":"fidian@rumkin.com","url":"http://rumkin.com/"}],"author":{"name":"Tyler Akins","email":"fidian@rumkin.com"},"bugs":{"url":"https://github.com/tests-always-included/option-parser/issues"},"license":"MIT","readmeFilename":"README.md","users":{"cliff":true}}