{"_id":"opts","_rev":"209050","name":"opts","description":"Command line argument parser with automatic help text generation.","dist-tags":{"latest":"2.0.2"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"time":{"modified":"2021-06-03T15:24:13.000Z","created":"2012-01-17T22:46:38.276Z","2.0.2":"2020-08-14T21:30:59.656Z","2.0.1":"2020-08-14T21:21:45.287Z","2.0.0":"2020-06-30T05:53:01.695Z","1.2.7":"2019-10-30T05:24:33.544Z","1.2.6":"2017-02-11T01:51:55.050Z","1.2.5":"2017-02-10T23:47:01.436Z","1.2.4":"2017-02-10T23:33:26.147Z","1.2.2":"2012-01-17T22:46:38.276Z","1.2.0":"2012-01-17T22:46:38.276Z","1.2.1":"2012-01-17T22:46:38.276Z"},"users":{},"author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"versions":{"2.0.2":{"name":"opts","description":"Command line argument parser with automatic help text generation.","version":"2.0.2","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"homepage":"http://khtdr.com/opts","repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"bugs":{"url":"https://github.com/khtdr/opts/issues"},"main":"src/opts","man":["man.3"],"types":"src/opts.d.ts","license":"BSD-2-Clause","keywords":["command line parser","opts","args","help text"],"devDependencies":{"@types/node":"^12.12.0"},"gitHead":"f09cc7b8193a18603164e86c26d69e9850d2ca27","_id":"opts@2.0.2","_nodeVersion":"12.14.1","_npmVersion":"6.14.5","dist":{"shasum":"a17e189fbbfee171da559edd8a42423bc5993ce1","size":8300,"noattachment":false,"key":"/opts/-/opts-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-2.0.2.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmUser":{"name":"mazzarelli","email":"ohkay@khtdr.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/opts_2.0.2_1597440659529_0.07875354987910277"},"_hasShrinkwrap":false,"publish_time":1597440659656,"_cnpm_publish_time":1597440659656},"2.0.1":{"name":"opts","description":"Command line argument parser with automatic help text generation.","version":"2.0.1","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"homepage":"http://github.com/khtdr/opts","repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"bugs":{"url":"https://github.com/khtdr/opts/issues"},"main":"src/opts","man":["opts.3"],"types":"src/opts.d.ts","license":"BSD-2-Clause","keywords":["command line parser","opts","args","help text"],"devDependencies":{"@types/node":"^12.12.0"},"gitHead":"5aa0d6544d5e09f169e255ae3193d02b72b13efe","_id":"opts@2.0.1","_nodeVersion":"12.14.1","_npmVersion":"6.14.5","dist":{"shasum":"3673fbe3cc191d911a9ea1bf87784c672e72d14f","size":7415,"noattachment":false,"key":"/opts/-/opts-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-2.0.1.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmUser":{"name":"mazzarelli","email":"ohkay@khtdr.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/opts_2.0.1_1597440105176_0.9377497721343575"},"_hasShrinkwrap":false,"publish_time":1597440105287,"_cnpm_publish_time":1597440105287},"2.0.0":{"name":"opts","homepage":"http://github.com/khtdr/opts","repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"version":"2.0.0","description":"Command line argument parser.","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"main":"src/opts","types":"src/opts.d.ts","license":"BSD-2-Clause","devDependencies":{"@types/node":"^12.12.0"},"gitHead":"7ea48a6977e0d224e51b0f773c811ee73c73165a","bugs":{"url":"https://github.com/khtdr/opts/issues"},"_id":"opts@2.0.0","_nodeVersion":"12.14.1","_npmVersion":"6.14.5","dist":{"shasum":"c0b2cebdf53eaeafc21ed844e34773758dcf41e2","size":6489,"noattachment":false,"key":"/opts/-/opts-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-2.0.0.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmUser":{"name":"mazzarelli","email":"ohkay@khtdr.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/opts_2.0.0_1593496381591_0.4843737576585181"},"_hasShrinkwrap":false,"publish_time":1593496381695,"_cnpm_publish_time":1593496381695},"1.2.7":{"name":"opts","homepage":"http://github.com/khtdr/opts","repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"version":"1.2.7","description":"Command line argument parser.","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"main":"src/opts","types":"src/opts.d.ts","license":"BSD-2-Clause","devDependencies":{"@types/node":"^12.12.0"},"gitHead":"eb8617111b1e04ace020c659a038b3bd4a245db7","bugs":{"url":"https://github.com/khtdr/opts/issues"},"_id":"opts@1.2.7","_nodeVersion":"11.6.0","_npmVersion":"6.12.1","dist":{"shasum":"4de4721d592c96901dae623a438c988e9ea7779f","size":5904,"noattachment":false,"key":"/opts/-/opts-1.2.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.7.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmUser":{"name":"mazzarelli","email":"ohkay@khtdr.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/opts_1.2.7_1572413073395_0.6824203005748912"},"_hasShrinkwrap":false,"publish_time":1572413073544,"_cnpm_publish_time":1572413073544},"1.2.6":{"name":"opts","homepage":"http://github.com/khtdr/opts","repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"version":"1.2.6","description":"Command line argument parser.","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"main":"src/opts","gitHead":"09c4644c3fa50cfb42d7764754be3554ea5b27ca","bugs":{"url":"https://github.com/khtdr/opts/issues"},"_id":"opts@1.2.6","scripts":{},"_shasum":"d185c0425cfdeb9da1d182908b65b5c0238febb3","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"mazzarelli","email":"mazzarelli@gmail.com"},"dist":{"shasum":"d185c0425cfdeb9da1d182908b65b5c0238febb3","size":5287,"noattachment":false,"key":"/opts/-/opts-1.2.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.6.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/opts-1.2.6.tgz_1486777913091_0.19255280308425426"},"directories":{},"publish_time":1486777915050,"_cnpm_publish_time":1486777915050,"_hasShrinkwrap":false},"1.2.5":{"name":"opts","homepage":"http://github.com/khtdr/opts","repository":{"type":"git","url":"git+https://github.com/khtdr/opts.git"},"version":"1.2.5","description":"Command line argument parser.","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"main":"src/opts","gitHead":"f1b2b170b365bfe35664a1816b1da8dad1e26cfe","bugs":{"url":"https://github.com/khtdr/opts/issues"},"_id":"opts@1.2.5","scripts":{},"_shasum":"f360ba9e2c63ea2f745d029b0a2fc3f4615d9555","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"mazzarelli","email":"mazzarelli@gmail.com"},"dist":{"shasum":"f360ba9e2c63ea2f745d029b0a2fc3f4615d9555","size":5669,"noattachment":false,"key":"/opts/-/opts-1.2.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.5.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/opts-1.2.5.tgz_1486770421203_0.8745139273814857"},"directories":{},"publish_time":1486770421436,"_cnpm_publish_time":1486770421436,"_hasShrinkwrap":false},"1.2.4":{"name":"opts","version":"1.2.4","description":"Command line argument parser written in the style of commonjs. To be used with node.js","author":{"name":"Oh Kay","email":"khtdr.com@gmail.com","url":"http://khtdr.com"},"main":"src/opts","gitHead":"4e18f3410872831c61f90d770647bd6815c3c7d5","_id":"opts@1.2.4","scripts":{},"_shasum":"d344bce643e0ec02bdb6e2b696a0371f2af096f1","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"mazzarelli","email":"mazzarelli@gmail.com"},"dist":{"shasum":"d344bce643e0ec02bdb6e2b696a0371f2af096f1","size":5652,"noattachment":false,"key":"/opts/-/opts-1.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.4.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/opts-1.2.4.tgz_1486769604315_0.9412257901858538"},"directories":{},"publish_time":1486769606147,"_cnpm_publish_time":1486769606147,"_hasShrinkwrap":false},"1.2.2":{"name":"opts","version":"1.2.2","description":"Command line argument parser written in the style of commonjs. To be used with node.js","author":{"name":"Joey Mazzarelli","email":"mazzarelli@gmail.com","url":"http://joey.mazzarelli.com"},"main":"js/opts","engines":{"node":">=0.1.90"},"_npmUser":{"name":"mazzarelli","email":"mazzarelli@gmail.com"},"_id":"opts@1.2.2","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-2","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"81782b93014a1cd88d56c226643fd4282473853d","size":4879,"noattachment":false,"key":"/opts/-/opts-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.2.tgz"},"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"directories":{},"publish_time":1326840398276,"_hasShrinkwrap":false,"_cnpm_publish_time":1326840398276},"1.2.0":{"name":"opts","version":"1.2.0","description":"Command line argument parser written in the style of commonjs. To be used with node.js","author":{"name":"Joey Mazzarelli","email":"mazzarelli@gmail.com","url":"http://joey.mazzarelli.com"},"main":"js/opts","engines":{"node":">=0.1.90"},"_id":"opts@1.2.0","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"shasum":"3ff8d608ffce4c479d715be1d2717976174a4bf1","size":4864,"noattachment":false,"key":"/opts/-/opts-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.0.tgz"},"directories":{},"publish_time":1326840398276,"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1326840398276},"1.2.1":{"name":"opts","version":"1.2.1","description":"Command line argument parser written in the style of commonjs. To be used with node.js","author":{"name":"Joey Mazzarelli","email":"mazzarelli@gmail.com","url":"http://joey.mazzarelli.com"},"main":"js/opts","engines":{"node":">=0.1.90"},"_id":"opts@1.2.1","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"shasum":"004648021d7881598ba0544b8db64b8e099dc8a7","size":4969,"noattachment":false,"key":"/opts/-/opts-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/opts/download/opts-1.2.1.tgz"},"directories":{},"publish_time":1326840398276,"maintainers":[{"name":"mazzarelli","email":"mazzarelli@gmail.com"}],"_hasShrinkwrap":false,"_cnpm_publish_time":1326840398276}},"readme":"\n# Table of Contents\n\n1.  [NAME](#orge2e86e0)\n2.  [SYNOPSIS](#org204fb4c)\n        1.  [running:](#orgb50b6e4)\n        2.  [produces:](#orgf51f8f5)\n        3.  [running:](#org8f49204)\n        4.  [produces:](#org3b1d910)\n        5.  [running:](#org24a1193)\n        6.  [produces:](#org12e29d4)\n3.  [INSTALLATION](#orgc33d993)\n    1.  [Stand-alone version](#org837b3bd)\n    2.  [NPM version](#orga066938)\n4.  [USAGE](#org55285ce)\n    1.  [LOADING](#org9df0af8)\n    2.  [CONFIGURING](#org5b0ccb9)\n        1.  [options](#org4ec5cb9)\n        2.  [arguments](#org73cc3f3)\n        3.  [help text generator](#org69f67a1)\n5.  [AUTHOR / CHANGELOG / LICENSE](#org702885b)\n\nFind the full documentation, source code, and examples online at <https://khtdr.com/opts>.\n\nOr download this README as a man-page.\n\n    curl -o opts.3 https://raw.githubusercontent.com/khtdr/opts/master/man.3\n    man ./opts.3\n\n\n<a id=\"orge2e86e0\"></a>\n\n# NAME\n\nopts.js - a command line parser for options and arguments\n\n\n<a id=\"org204fb4c\"></a>\n\n# SYNOPSIS\n\nThe following example uses a custom **version** function, and opts in to the automatic help text. No pun intended.\n\n    var opts = require('opts');\n    \n    var options = [\n      { short       : 'v'\n      , long        : 'version'\n      , description : 'Show version and exit'\n      , callback    : function () { console.log('v1.0'); process.exit(1); }\n      }\n    ];\n    \n    opts.parse(options, true);\n    console.log('Example 1');\n    process.exit(0);\n\nSee <https://raw.githubusercontent.com/khtdr/opts/master/examples/example1.js>\n\n\n<a id=\"orgb50b6e4\"></a>\n\n### running:\n\n    $ node ./example1\n\n\n<a id=\"orgf51f8f5\"></a>\n\n### produces:\n\n    Example 1\n\n\n<a id=\"org8f49204\"></a>\n\n### running:\n\n    $ node ./example1 --help\n\n\n<a id=\"org3b1d910\"></a>\n\n### produces:\n\n    Usage: node ./example1 [options]\n    Show this help message\n       --help\n    Show version and exit\n       -v, --version\n\n\n<a id=\"org24a1193\"></a>\n\n### running:\n\n    node ./example1 -v\n\n\n<a id=\"org12e29d4\"></a>\n\n### produces:\n\n    v1.0\n\n\n<a id=\"orgc33d993\"></a>\n\n# INSTALLATION\n\nYou do not need to use NPM or any package manager. It is written in plain-old Javascript and can be downloaded and included in your Node.js project, as-is. All of the examples use this approach.\n.RE\nSee <https://github.com/khtdr/opts/tree/master/examples>\n\n\n<a id=\"org837b3bd\"></a>\n\n## Stand-alone version\n\n    cd /path/to/your/project\n    curl -o opts.js https://raw.githubusercontent.com/khtdr/opts/master/src/opts.js\n\n\n<a id=\"orga066938\"></a>\n\n## NPM version\n\n    npm install opts\n\n\n<a id=\"org55285ce\"></a>\n\n# USAGE\n\n\n<a id=\"org9df0af8\"></a>\n\n## LOADING\n\nWith classic syntax:\n\n    var opts = require('opts');\n    opts.parse(options, arguments, help);\n\nWith modern syntax:\n\n    import * as opts from 'opts';\n    opts.parse(options, arguments, help);\n\nIf you installed `opts` with NPM, the typescript definitions should automatically be available in your editor. Otherwise you can download the .d.ts file manually.\n.RE\nSee <https://raw.githubusercontent.com/khtdr/opts/master/src/opts.d.ts>\n\n\n<a id=\"org5b0ccb9\"></a>\n\n## CONFIGURING\n\n`opts.parse(options, arguments, help)`\n\nOptions are flag-arguments. Arguments are everything else. Consider the following hypothetical command for starting a server that listens on <http://0.0.0.0:4000>\n\n    node ./my-app start --host 0.0.0.0 -p 4000\n\nIn this example, the options are `--host 0.0.0.0` and `-p 4000`. The argument is `start`. The arguments can be after, before, or among the options.\n\n\n<a id=\"org4ec5cb9\"></a>\n\n### options\n\n`options` is an array of option objects. Each option in the array can have the following fields. None are required, but you should at least provide a short or long name.\n\n    let options = [\n      { short       : 'l',\n        long        : 'list',\n        description : 'Show a list',\n        value       : false, // default false\n        required    : true, // default false\n        callback    : function (value) { ... },\n      }, // ... followed by more options\n    ];\n\n\n<a id=\"org73cc3f3\"></a>\n\n### arguments\n\n`arguments` require less configuration. This is an optional argument to `opts.parse`:\n\n    let arguments =\n      { name     : 'script',\n        required : true, // not required by default\n        callback : function (value) { ... },\n      };\n\n\n<a id=\"org69f67a1\"></a>\n\n### help text generator\n\nFinally, you can add an automatically generated help message by passing\na last parameter of `true`. This is also an optional argument to `opts.parse`.\n\n    opts.parse(options, true);\n    // or if you want more control, you can do:\n    /*\n      options.push({\n        long        : 'help',\n        description : 'Show this help message',\n        callback    : require('opts').help,\n      }\n      opts.parse(options);\n    */\n\n\n<a id=\"org702885b\"></a>\n\n# AUTHOR / CHANGELOG / LICENSE\n\nEmail: ohkay@khtdr.com\n\nRelatively unchanged since 2010.\n.RE\nSee <https://github.com/khtdr/opts/blob/master/CHANGES.org>\n\nBSD 2-Clause License\n.RE\nSee <https://github.com/khtdr/opts/blob/master/LICENSE.txt>\n\n","_attachments":{},"homepage":"http://khtdr.com/opts","bugs":{"url":"https://github.com/khtdr/opts/issues"},"license":"BSD-2-Clause"}