arguably

Command line arguments parser

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 google.com --name bob

or

    node args.js --url yahoo.com --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
                        .option(
                            '-n, --name',
                            /* description */ 'Your name',
                            /* default value */ 'unknown'
                        )
                        .option('-u, --url')
                        .done() //don't forget to call this at the end
 
    console.log(args.name)
    args.name === args.n
 
    console.log(args.url)
    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