mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Implement plugin install command
This commit is contained in:
parent
7dd34f4a0e
commit
82ac558d7f
@ -19,10 +19,6 @@ exports.list =
|
||||
|
||||
(callback) ->
|
||||
npm.load
|
||||
|
||||
# TODO: Maybe we should check the local modules as well?
|
||||
global: true
|
||||
|
||||
depth: 0
|
||||
parseable: true
|
||||
, callback
|
||||
@ -36,6 +32,10 @@ exports.list =
|
||||
# TODO: Reuse plugin glob from app.coffee
|
||||
return _.str.startsWith(resinModule.name, 'resin-plugin')
|
||||
|
||||
if _.isEmpty(resinModules)
|
||||
console.log('You don\'t have any plugins yet')
|
||||
return done()
|
||||
|
||||
console.log visuals.widgets.table.horizontal resinModules, [
|
||||
'name'
|
||||
'version'
|
||||
@ -46,3 +46,36 @@ exports.list =
|
||||
return callback()
|
||||
|
||||
], done)
|
||||
|
||||
exports.install =
|
||||
signature: 'plugin install <name>'
|
||||
description: 'install a plugin'
|
||||
help: '''
|
||||
Use this command to install a resin plugin
|
||||
|
||||
Examples:
|
||||
$ resin plugin install hello
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
npm.load({}, callback)
|
||||
|
||||
(data, callback) ->
|
||||
|
||||
# TODO: This action outputs installation information that cannot
|
||||
# be quieted neither with --quiet nor --silent:
|
||||
# https://github.com/npm/npm/issues/2040
|
||||
npm.commands.install([
|
||||
"resin-plugin-#{params.name}"
|
||||
], callback)
|
||||
|
||||
], (error) ->
|
||||
return done() if not error?
|
||||
|
||||
if error.code is 'E404'
|
||||
error.message = "Plugin not found: #{params.name}"
|
||||
|
||||
return done(error) if error?
|
||||
|
@ -102,6 +102,7 @@ capitano.command(actions.examples.info)
|
||||
|
||||
# ---------- Plugins Module ----------
|
||||
capitano.command(actions.plugin.list)
|
||||
capitano.command(actions.plugin.install)
|
||||
|
||||
changeProjectDirectory = (directory) ->
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user