mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-29 15:44:26 +00:00
Implement key:rm command
This commit is contained in:
parent
832cbf89ff
commit
29054bedf1
@ -2,6 +2,7 @@ _ = require('lodash')
|
||||
server = require('../server/server')
|
||||
authHooks = require('../hooks/auth')
|
||||
log = require('../log/log')
|
||||
patterns = require('../patterns/patterns')
|
||||
table = require('../table/table')
|
||||
helpers = require('../helpers/helpers')
|
||||
keyModel = require('../models/key')
|
||||
@ -29,3 +30,9 @@ exports.info = authHooks.failIfNotLoggedIn (id) ->
|
||||
|
||||
key.public_key = '\n' + helpers.formatLongString(key.public_key, config.sshKeyWidth)
|
||||
log.out(table.vertical(key, _.identity, [ 'ID', 'Title', 'Public Key' ]))
|
||||
|
||||
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
|
||||
patterns.remove 'key', program.parent.yes, (callback) ->
|
||||
server.delete("/user/keys/#{id}", callback)
|
||||
, (error) ->
|
||||
throw error if error?
|
||||
|
@ -92,6 +92,11 @@ program
|
||||
.description('List a single SSH key')
|
||||
.action(keys.info)
|
||||
|
||||
program
|
||||
.command('key:rm <id>')
|
||||
.description('Remove a SSH key')
|
||||
.action(keys.remove)
|
||||
|
||||
data.prefix.set config.dataPrefix, (error) ->
|
||||
throw error if error?
|
||||
program.parse(process.argv)
|
||||
|
Loading…
x
Reference in New Issue
Block a user