diff --git a/maxctrl/lib/alter.js b/maxctrl/lib/alter.js index 7150beea5..8c9fd56b3 100644 --- a/maxctrl/lib/alter.js +++ b/maxctrl/lib/alter.js @@ -44,7 +44,9 @@ exports.builder = function(yargs) { }) .usage('Usage: alter ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help alter` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help alter` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/call.js b/maxctrl/lib/call.js index 868159dfc..3f9344cbe 100644 --- a/maxctrl/lib/call.js +++ b/maxctrl/lib/call.js @@ -40,7 +40,9 @@ exports.builder = function(yargs) { }) .usage('Usage: call ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help call` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help call` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/clear.js b/maxctrl/lib/clear.js index 2c8fa57e2..28354306f 100644 --- a/maxctrl/lib/clear.js +++ b/maxctrl/lib/clear.js @@ -25,7 +25,9 @@ exports.builder = function(yargs) { }) .usage('Usage: clear ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help clear` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help clear` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/common.js b/maxctrl/lib/common.js index 7c3d89625..96bb55e7a 100644 --- a/maxctrl/lib/common.js +++ b/maxctrl/lib/common.js @@ -44,6 +44,9 @@ module.exports = function() { }) return Promise.all(promises) + .catch(function(err) { + argv.reject() + }) }, function(err) { // One of the HTTP request pings to the cluster failed, log the error logError(JSON.stringify(err.error, null, 4)) @@ -209,7 +212,7 @@ module.exports = function() { this.error = function(err) { logger.log(colors.red('Error:'), err) - this.argv.reject() + return Promise.reject() } } diff --git a/maxctrl/lib/create.js b/maxctrl/lib/create.js index 03c08f565..a3f9ce947 100644 --- a/maxctrl/lib/create.js +++ b/maxctrl/lib/create.js @@ -193,7 +193,9 @@ exports.builder = function(yargs) { .usage('Usage: create ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help create` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help create` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/destroy.js b/maxctrl/lib/destroy.js index 58185a562..8065fcc88 100644 --- a/maxctrl/lib/destroy.js +++ b/maxctrl/lib/destroy.js @@ -39,7 +39,9 @@ exports.builder = function(yargs) { }) .usage('Usage: destroy ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help destroy` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help destroy` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/disable.js b/maxctrl/lib/disable.js index a9ca6dc96..5822b0b14 100644 --- a/maxctrl/lib/disable.js +++ b/maxctrl/lib/disable.js @@ -31,8 +31,7 @@ exports.builder = function(yargs) { }) } else { maxctrl(argv, function() { - error('Invalid log priority: ' + argv.log) - return Promise.reject() + return error('Invalid log priority: ' + argv.log) }) } }) @@ -43,7 +42,9 @@ exports.builder = function(yargs) { }) .usage('Usage: disable ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help disable` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help disable` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/enable.js b/maxctrl/lib/enable.js index dd51a3ff3..c4eb3bdd0 100644 --- a/maxctrl/lib/enable.js +++ b/maxctrl/lib/enable.js @@ -31,8 +31,7 @@ exports.builder = function(yargs) { }) } else { maxctrl(argv, function() { - error('Invalid log priority: ' + argv.log) - return Promise.reject() + return error('Invalid log priority: ' + argv.log) }) } }) @@ -49,7 +48,9 @@ exports.builder = function(yargs) { }) .usage('Usage: enable ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help enable` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help enable` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/link.js b/maxctrl/lib/link.js index fc0e8dcd9..65871a46a 100644 --- a/maxctrl/lib/link.js +++ b/maxctrl/lib/link.js @@ -43,7 +43,9 @@ exports.builder = function(yargs) { }) .usage('Usage: link ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help link` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help link` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/list.js b/maxctrl/lib/list.js index 23eb6a9fc..b67c41ad4 100644 --- a/maxctrl/lib/list.js +++ b/maxctrl/lib/list.js @@ -103,7 +103,9 @@ exports.builder = function(yargs) { }) .usage('Usage: list ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help list` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help list` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/rotate.js b/maxctrl/lib/rotate.js index e04164d7f..29757ac27 100644 --- a/maxctrl/lib/rotate.js +++ b/maxctrl/lib/rotate.js @@ -24,7 +24,9 @@ exports.builder = function(yargs) { }) .usage('Usage: rotate ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help rotate` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help rotate` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/set.js b/maxctrl/lib/set.js index d09f76a3e..403a86657 100644 --- a/maxctrl/lib/set.js +++ b/maxctrl/lib/set.js @@ -25,7 +25,9 @@ exports.builder = function(yargs) { }) .usage('Usage: set ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help set` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help set` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/show.js b/maxctrl/lib/show.js index e2fe564c0..61e4e62ea 100644 --- a/maxctrl/lib/show.js +++ b/maxctrl/lib/show.js @@ -128,7 +128,9 @@ exports.builder = function(yargs) { }) .usage('Usage: show ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help show` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help show` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/start.js b/maxctrl/lib/start.js index 6b1923450..f54dd6ae4 100644 --- a/maxctrl/lib/start.js +++ b/maxctrl/lib/start.js @@ -29,7 +29,9 @@ exports.builder = function(yargs) { }) .usage('Usage: start ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help start` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help start` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/stop.js b/maxctrl/lib/stop.js index db546b53e..7b0448732 100644 --- a/maxctrl/lib/stop.js +++ b/maxctrl/lib/stop.js @@ -29,7 +29,9 @@ exports.builder = function(yargs) { }) .usage('Usage: stop ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help stop` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help stop` for a list of commands.') + }) }) } diff --git a/maxctrl/lib/unlink.js b/maxctrl/lib/unlink.js index b68bb51be..fe01fd964 100644 --- a/maxctrl/lib/unlink.js +++ b/maxctrl/lib/unlink.js @@ -43,7 +43,9 @@ exports.builder = function(yargs) { }) .usage('Usage: unlink ') .help() - .command('*', 'the default command', {}, () => { - logger.log('Unknown command. See output of `help unlink` for a list of commands.') + .command('*', 'the default command', {}, function(argv) { + maxctrl(argv, function(host) { + return error('Unknown command. See output of `help unlink` for a list of commands.') + }) }) }