Code coverage report for lib/cli.js

Statements: 100% (11 / 11)      Branches: 100% (8 / 8)      Functions: 100% (3 / 3)      Lines: 100% (11 / 11)      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 401       1 1 1     1   2                   2           1   4             4     1
var cli = require('bagofcli'),
  Couchtato = require('./couchtato'),
  p = require('path');
 
function _config() {
  console.log('Creating example couchtato.js config');
  new Couchtato().config(cli.exit);
}
 
function _iterate(args) {
 
  var config = require(p.join(process.cwd(), args.configFile || 'couchtato')),
    opts = {
      batchSize: (args.batchSize) ? parseInt(args.batchSize, 10) : undefined,
      pageSize: (args.pageSize) ? parseInt(args.pageSize, 10) : undefined,
      numPages: (args.numPages) ? parseInt(args.numPages, 10) : undefined,
      startKey: args.startKey,
      endKey: args.endKey,
      quiet: args.quiet
    };
 
  new Couchtato().iterate(config.conf.tasks, args.url, opts, cli.exit);
}
 
/**
 * Execute Couchtato CLI.
 */
function exec() {
 
  var actions = {
    commands: {
      config: { action: _config },
      iterate: { action: _iterate }
    }
  };
 
  cli.command(__dirname, actions);
}
 
exports.exec = exec;