@complyify/cli
Installation
npm install @complyify/cli
Parameters
Parameter values can be provided via:
-
configuration file
, or -
environment variable
, or command line argument
Should a parameter be provided in multiple places, the effective value will be that of the last place to specify, which is evaluated in the aforementioned order.
i.e., command line argument
before environment variable
before configuration file
Usage
#!/usr/bin/env node
import CLI from '@complyify/cli';
import Promise from 'bluebird';
async function report() {
console.log(`report from "${this.name}"`);
// TODO implement whatever report stuff you want to do here
}
async function debug() {
console.log('debug on');
// TODO enable your debugging here
}
CLI.create('my-app')
.param({ arg: 's', cfg: 'some.where.out.there', env: 'OVER_THE_RAINBOW', desc: 'way up high' })
.flag({ arg: 'd', desc: 'debug', handler: debug })
.default({ desc: 'generate report', handler: report })
.exec().catch(err => console.error(err));