Code coverage report for lib/cli.js

Statements: 100% (20 / 20)      Branches: 100% (10 / 10)      Functions: 100% (4 / 4)      Lines: 100% (20 / 20)      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 42 43 44 45 46 47 481       1 1 1     1 3   3 3 1     3     1 2   2 2 1     2           1   7               7     1
var _ = require('lodash'),
  bag = require('bagofcli'),
  Breaker = require('./breaker');
 
function _init() {
  console.log('Creating sample Breaker hosts file: .breaker.json');
  new Breaker().init(bag.exit);
}
 
function _format(args) {
  args = args || {};
 
  var opts = {};
  if (args.labels) {
    opts.labels = args.labels.split(',');
  }
 
  new Breaker(opts).format(args.type || 'sshconfig', bag.exit);
}
 
function _ssh(command, args) {
  args = args || {};
 
  var opts = {};
  if (args.labels) {
    opts.labels = args.labels.split(',');
  }
 
  new Breaker(opts).ssh(command, bag.exit);
}
 
/**
 * Execute Breaker.
 */
function exec() {
 
  var actions = {
    commands: {
      init: { action: _init },
      format: { action: _format },
      ssh: { action: _ssh }
    }
  };
 
  bag.command(__dirname, actions);
}
 
exports.exec = exec;