cliable
v0.1.1
Published
Add some options
Downloads
2
Readme
CLIABLE
Easily add options to your cli's
Installation
In your projects directory:
npm install --save cliable
Usage
In node.js:
#!/usr/bin/env node
const args = require('cliable');
args.addOption('domain', 'Some domainz', 'exapmle.com');
args.addOption('port', 'Da port', 80);
var arguments = args.start(process.argv.slice(2), 'A helpful text');
//do something with arguments
Cli usage
Users can pass in options using yourapp --port 3000
.
Accessing options in your code
if (arguments.domain) {
// you can access arguments.domain
console.log(arguments.domain)
}
Using help
arguments.help
is false
if everything is fine, else it's a string you can log to the console.
That's is!