balena-cli/lib/utils/plugins.coffee
Juan Cruz Viotti 7f4863da86 Upgrade Nplugm to v3.0.0
This new version supports promises and contains speed improvements.
2015-08-19 11:27:28 -04:00

12 lines
329 B
CoffeeScript

nplugm = require('nplugm')
_ = require('lodash')
capitano = require('capitano')
exports.register = (regex) ->
nplugm.list(regex).map (plugin) ->
command = require(plugin)
return capitano.command(command) if not _.isArray(command)
return _.each(command, capitano.command)
.catch (error) ->
console.error(error.message)