Command line arguments parser

Downloads in past


0.1.610 years ago10 years agoMinified + gzip package size for arguably in KB


arguably ======== Command line arguments parser for node.js Usage ==== Let's say you have a script args.js, and call it with ```
node args.js -u --name bob
``` or ```
node args.js --url --name bill
``` And want to simply print the given url and name. Your script should use arguably like this: ```
var arguably = require('arguably'),
args     = arguably
'-n, --name',
/* description */ 'Your name',
/* default value */ 'unknown'
.option('-u, --url')
.done() //don't forget to call this at the end
console.log( === args.n
args.url === args.u
``` Notice that the args variable returned by arguably is an object with key/value pairs, as specified in the option description. On options with multiple aliases. like the url (-u or --url), the args has the save value for both of the aliases ```
args.u === args.url