mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
97d9b7816f
Print plugin warnings in red as other errors
27 lines
604 B
JavaScript
27 lines
604 B
JavaScript
(function() {
|
|
var _, capitano, nplugm, patterns;
|
|
|
|
nplugm = require('nplugm');
|
|
|
|
_ = require('lodash');
|
|
|
|
capitano = require('capitano');
|
|
|
|
patterns = require('./patterns');
|
|
|
|
exports.register = function(regex) {
|
|
return nplugm.list(regex).map(function(plugin) {
|
|
var command;
|
|
command = require(plugin);
|
|
command.plugin = true;
|
|
if (!_.isArray(command)) {
|
|
return capitano.command(command);
|
|
}
|
|
return _.each(command, capitano.command);
|
|
})["catch"](function(error) {
|
|
return patterns.printErrorMessage(error.message);
|
|
});
|
|
};
|
|
|
|
}).call(this);
|