mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-29 15:44:26 +00:00
Implement key list command
This commit is contained in:
parent
a189e21c30
commit
c4bb275923
12
lib/actions/keys.coffee
Normal file
12
lib/actions/keys.coffee
Normal file
@ -0,0 +1,12 @@
|
||||
server = require('../server/server')
|
||||
authHooks = require('../hooks/auth')
|
||||
table = require('../table/table')
|
||||
config = require('../config')
|
||||
|
||||
exports.list = authHooks.failIfNotLoggedIn ->
|
||||
server.get config.urls.keys, (error, response, keys) ->
|
||||
throw error if error?
|
||||
console.log table.horizontal keys, (key) ->
|
||||
delete key.public_key
|
||||
return key
|
||||
, [ 'ID', 'Title' ]
|
@ -32,6 +32,10 @@ yargs.command('preferences', preferences.preferences)
|
||||
version = require('./actions/version')
|
||||
yargs.command('version', version.version)
|
||||
|
||||
# ---------- Keys Module ----------
|
||||
keys = require('./actions/keys')
|
||||
yargs.command('keys', keys.list)
|
||||
|
||||
data.prefix.set config.dataPrefix, (error) ->
|
||||
throw error if error?
|
||||
yargs.command.run()
|
||||
|
@ -15,6 +15,7 @@ config =
|
||||
config.urls =
|
||||
signup: '/signup'
|
||||
preferences: '/preferences'
|
||||
keys: '/user/keys'
|
||||
|
||||
# Append config.remoteUrl before every url
|
||||
config.urls = _.object _.map config.urls, (value, key, object) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user