mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-19 11:16:38 +00:00
Implement plugins command
This commit is contained in:
parent
a84c3d5c9f
commit
74b1092e9a
@ -12,3 +12,4 @@ module.exports =
|
|||||||
os: require('./os')
|
os: require('./os')
|
||||||
help: require('./help')
|
help: require('./help')
|
||||||
examples: require('./examples')
|
examples: require('./examples')
|
||||||
|
plugin: require('./plugin')
|
||||||
|
48
lib/actions/plugin.coffee
Normal file
48
lib/actions/plugin.coffee
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
_ = require('lodash')
|
||||||
|
_.str = require('underscore.string')
|
||||||
|
async = require('async')
|
||||||
|
npm = require('npm')
|
||||||
|
visuals = require('resin-cli-visuals')
|
||||||
|
|
||||||
|
exports.list =
|
||||||
|
signature: 'plugins'
|
||||||
|
description: 'list all plugins'
|
||||||
|
help: '''
|
||||||
|
Use this command to list all the installed resin plugins.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
$ resin plugins
|
||||||
|
'''
|
||||||
|
permission: 'user'
|
||||||
|
action: (params, options, done) ->
|
||||||
|
async.waterfall([
|
||||||
|
|
||||||
|
(callback) ->
|
||||||
|
npm.load
|
||||||
|
|
||||||
|
# TODO: Maybe we should check the local modules as well?
|
||||||
|
global: true
|
||||||
|
|
||||||
|
depth: 0
|
||||||
|
parseable: true
|
||||||
|
, callback
|
||||||
|
|
||||||
|
(data, callback) ->
|
||||||
|
npm.commands.list([], true, callback)
|
||||||
|
|
||||||
|
(data, lite, callback) ->
|
||||||
|
resinModules = _.filter _.values(data.dependencies), (resinModule) ->
|
||||||
|
|
||||||
|
# TODO: Reuse plugin glob from app.coffee
|
||||||
|
return _.str.startsWith(resinModule.name, 'resin-plugin')
|
||||||
|
|
||||||
|
console.log visuals.widgets.table.horizontal resinModules, [
|
||||||
|
'name'
|
||||||
|
'version'
|
||||||
|
'description'
|
||||||
|
'license'
|
||||||
|
]
|
||||||
|
|
||||||
|
return callback()
|
||||||
|
|
||||||
|
], done)
|
@ -100,6 +100,9 @@ capitano.command(actions.examples.list)
|
|||||||
capitano.command(actions.examples.clone)
|
capitano.command(actions.examples.clone)
|
||||||
capitano.command(actions.examples.info)
|
capitano.command(actions.examples.info)
|
||||||
|
|
||||||
|
# ---------- Plugins Module ----------
|
||||||
|
capitano.command(actions.plugin.list)
|
||||||
|
|
||||||
changeProjectDirectory = (directory) ->
|
changeProjectDirectory = (directory) ->
|
||||||
try
|
try
|
||||||
process.chdir(directory)
|
process.chdir(directory)
|
||||||
|
Loading…
Reference in New Issue
Block a user