mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 15:02:22 +00:00
24 lines
515 B
JavaScript
24 lines
515 B
JavaScript
|
(function() {
|
||
|
var _, capitano, nplugm;
|
||
|
|
||
|
nplugm = require('nplugm');
|
||
|
|
||
|
_ = require('lodash');
|
||
|
|
||
|
capitano = require('capitano');
|
||
|
|
||
|
exports.register = function(regex) {
|
||
|
return nplugm.list(regex).map(function(plugin) {
|
||
|
var command;
|
||
|
command = require(plugin);
|
||
|
if (!_.isArray(command)) {
|
||
|
return capitano.command(command);
|
||
|
}
|
||
|
return _.each(command, capitano.command);
|
||
|
})["catch"](function(error) {
|
||
|
return console.error(error.message);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
}).call(this);
|