Code coverage report for lib/cli.js

Statements: 100% (19 / 19)      Branches: 100% (0 / 0)      Functions: 100% (5 / 5)      Lines: 100% (19 / 19)      Ignored: none     

All files » lib/ » cli.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 421 1   1 1 1     1   1 1   1 2     1 1 1   1 1             1   3             3     1
var Cmdt = require('./cmdt');
var cli = require('bagofcli');
 
function _init() {
  console.log('Creating sample test files');
  new Cmdt().init(cli.exit);
}
 
function _run() {
 
  var _arguments = arguments;
  var args       = [];
 
  Object.keys(_arguments).forEach(function (key) {
    args.push(_arguments[key]);
  });
 
  var config = args[args.length - 1];
  var cmdt   = new Cmdt({ debug: config.debug, baseDir: config.baseDir });
  var files  = cli.files(args.slice(0, args.length - 1), { match: '.+.yml$' });
 
  cmdt.run(files, cli.exitCb(null, function (results) {
    process.exit(results.failures.length);
  }));
}
 
/**
 * Execute Cmdt CLI.
 */
function exec() {
 
  var actions = {
    commands: {
      init: { action: _init },
      run : { action: _run }
    }
  };
 
  cli.command(__dirname, actions);
}
 
exports.exec = exec;