const Interface = require('./cli');
// Create CLInterface
var cli = new Interface({ version: '1.0.0', outfn: console.log });
cli
.command('add', {
params: '[Number] [Number]',
description: 'Adds two numbers'
})
.option('t', 'third', '[number3]', 'Adds a third number')
.callBack(function(opts, n1, n2) {
var n3 = opts.get('third', Number),
sum = Number(n1) + Number(n2);
if (n3) sum += n3;
this.output("Result: " + sum);
})
cli.parse('add -t=4 1 2');
// Result: 7