balena-cli/lib/utils/plugins.coffee
Juan Cruz Viotti f8470287c1 Separate general help per topic relevance
Only list primary commands by default, unless a `--verbose` option is
passed to list the additional ones.

Fixes: https://github.com/resin-io/resin-cli/issues/101
2015-10-02 08:50:32 -04:00

13 lines
353 B
CoffeeScript

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