mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-31 16:36:24 +00:00
Implement env:rm command
This commit is contained in:
parent
7988b0cbbe
commit
b9d5b0fd59
@ -1,5 +1,6 @@
|
||||
_ = require('lodash')
|
||||
table = require('../table/table')
|
||||
patterns = require('../patterns/patterns')
|
||||
log = require('../log/log')
|
||||
environemtVariablesModel = require('../models/environment-variables')
|
||||
authHooks = require('../hooks/auth')
|
||||
@ -23,3 +24,11 @@ exports.list = authHooks.failIfNotLoggedIn (program) ->
|
||||
log.out(table.horizontal(environmentVariables))
|
||||
.catch (error) ->
|
||||
throw error
|
||||
|
||||
exports.remove = authHooks.failIfNotLoggedIn (id, program) ->
|
||||
patterns.remove 'environment variable', program.parent.yes, (callback) ->
|
||||
environemtVariablesModel.remove(id).then ->
|
||||
return callback()
|
||||
.catch(callback)
|
||||
, (error) ->
|
||||
throw error if error?
|
||||
|
@ -122,6 +122,11 @@ program
|
||||
.description('List all environment variables')
|
||||
.action(env.list)
|
||||
|
||||
program
|
||||
.command('env:rm <id>')
|
||||
.description('Remove environment variable')
|
||||
.action(env.remove)
|
||||
|
||||
data.prefix.set config.dataPrefix, (error) ->
|
||||
throw error if error?
|
||||
program.parse(process.argv)
|
||||
|
@ -13,3 +13,8 @@ exports.getAll = (applicationId) ->
|
||||
if not environmentVariables?
|
||||
return Promise.reject(new Error('Not found'))
|
||||
return environmentVariables
|
||||
|
||||
exports.remove = (id) ->
|
||||
return canvas.delete
|
||||
resource: 'environment_variable'
|
||||
id: id
|
||||
|
Loading…
x
Reference in New Issue
Block a user