Print plugin warnings in red as other errors

For the sake of consistency.
This commit is contained in:
Juan Cruz Viotti 2015-10-06 18:51:17 -04:00
parent 3cc41ed62a
commit ec77437080
6 changed files with 23 additions and 7 deletions

View File

@ -1,10 +1,12 @@
(function() {
var chalk, errors;
var chalk, errors, patterns;
chalk = require('chalk');
errors = require('resin-cli-errors');
patterns = require('./utils/patterns');
exports.handle = function(error) {
var message;
message = errors.interpret(error);
@ -14,7 +16,7 @@
if (process.env.DEBUG) {
message = error.stack;
}
console.error(chalk.red(message));
patterns.printErrorMessage(message);
return process.exit(error.exitCode || 1);
};

View File

@ -1,5 +1,5 @@
(function() {
var Promise, _, form, helpers, resin, visuals;
var Promise, _, chalk, form, helpers, resin, visuals;
_ = require('lodash');
@ -11,6 +11,8 @@
resin = require('resin-sdk');
chalk = require('chalk');
helpers = require('./helpers');
exports.selectDeviceType = function() {
@ -113,4 +115,8 @@
});
};
exports.printErrorMessage = function(message) {
return console.error(chalk.red(message));
};
}).call(this);

View File

@ -1,5 +1,5 @@
(function() {
var _, capitano, nplugm;
var _, capitano, nplugm, patterns;
nplugm = require('nplugm');
@ -7,6 +7,8 @@
capitano = require('capitano');
patterns = require('./patterns');
exports.register = function(regex) {
return nplugm.list(regex).map(function(plugin) {
var command;
@ -16,7 +18,7 @@
}
return _.each(command, capitano.command);
})["catch"](function(error) {
return console.error(error.message);
return patterns.printErrorMessage(error.message);
});
};

View File

@ -1,5 +1,6 @@
chalk = require('chalk')
errors = require('resin-cli-errors')
patterns = require('./utils/patterns')
exports.handle = (error) ->
message = errors.interpret(error)
@ -8,5 +9,5 @@ exports.handle = (error) ->
if process.env.DEBUG
message = error.stack
console.error(chalk.red(message))
patterns.printErrorMessage(message)
process.exit(error.exitCode or 1)

View File

@ -3,6 +3,7 @@ Promise = require('bluebird')
form = require('resin-cli-form')
visuals = require('resin-cli-visuals')
resin = require('resin-sdk')
chalk = require('chalk')
helpers = require('./helpers')
exports.selectDeviceType = ->
@ -80,3 +81,6 @@ exports.awaitDevice = (uuid) ->
resin.models.device.getName(uuid).then (deviceName) ->
console.info("Waiting for #{deviceName} to connect to resin...")
poll().return(uuid)
exports.printErrorMessage = (message) ->
console.error(chalk.red(message))

View File

@ -1,6 +1,7 @@
nplugm = require('nplugm')
_ = require('lodash')
capitano = require('capitano')
patterns = require('./patterns')
exports.register = (regex) ->
nplugm.list(regex).map (plugin) ->
@ -8,4 +9,4 @@ exports.register = (regex) ->
return capitano.command(command) if not _.isArray(command)
return _.each(command, capitano.command)
.catch (error) ->
console.error(error.message)
patterns.printErrorMessage(error.message)