Plato on Github
Report Home
lib/cli.js
Maintainability
75.85
Lines of code
50
Difficulty
12.83
Estimated Errors
0.26
Function weight
By Complexity
By SLOC
var async = require('async'), bag = require('bagofcli'), prompt = require('prompt'), Roombox = require('./roombox'); function _start(args) { var opts = { path: args.path, baudrate: args.baudRate, dir: 'data/' }; var roombox = new Roombox(); roombox.start(opts, function () { async.whilst(_check, _prompt, bag.exit); }); var answer; function _check() { return answer !== 'e'; } function _prompt(cb) { prompt.start(); prompt.get(['Select track'], function (err, result) { answer = result['Select track']; if (answer !== 'e') { roombox.play(answer, cb); } else { cb(); } }); } } /** * Execute Roombox CLI. */ function exec() { var actions = { commands: { start: { action: _start } } }; bag.command(__dirname, actions); } exports.exec = exec;