mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
Allow increasing verbosity for envs command
This commit is contained in:
parent
a8a78f0749
commit
7988b0cbbe
@ -4,6 +4,11 @@ log = require('../log/log')
|
||||
environemtVariablesModel = require('../models/environment-variables')
|
||||
authHooks = require('../hooks/auth')
|
||||
|
||||
SYSTEM_VAR_REGEX = /^RESIN_/
|
||||
|
||||
isSystemVariable = (environmentVariable) ->
|
||||
SYSTEM_VAR_REGEX.test(environmentVariable.name)
|
||||
|
||||
exports.list = authHooks.failIfNotLoggedIn (program) ->
|
||||
applicationId = program.parent.application
|
||||
|
||||
@ -11,6 +16,10 @@ exports.list = authHooks.failIfNotLoggedIn (program) ->
|
||||
throw new Error('You have to specify an application')
|
||||
|
||||
environemtVariablesModel.getAll(applicationId).then (environmentVariables) ->
|
||||
|
||||
if not program.parent.verbose?
|
||||
environmentVariables = _.reject(environmentVariables, isSystemVariable)
|
||||
|
||||
log.out(table.horizontal(environmentVariables))
|
||||
.catch (error) ->
|
||||
throw error
|
||||
|
@ -8,7 +8,8 @@ program = require('commander')
|
||||
program.version(packageJSON.version)
|
||||
|
||||
# ---------- Options ----------
|
||||
program.option('-y, --yes', 'Confirm non interactively')
|
||||
program.option('-y, --yes', 'confirm non interactively')
|
||||
program.option('-v, --verbose', 'increase verbosity')
|
||||
program.option('-q, --quiet', 'quiet (no output)')
|
||||
program.option('-t, --type <type>', 'specify a type when creating an application')
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
_ = require('lodash')
|
||||
Promise = require('bluebird')
|
||||
canvas = require('./_canvas')
|
||||
|
||||
SYSTEM_VAR_REGEX = /^RESIN_/
|
||||
|
||||
isSystemVariable = (environmentVariable) ->
|
||||
SYSTEM_VAR_REGEX.test(environmentVariable.name)
|
||||
|
||||
exports.getAll = (applicationId) ->
|
||||
return canvas.get
|
||||
resource: 'environment_variable'
|
||||
@ -18,5 +12,4 @@ exports.getAll = (applicationId) ->
|
||||
.then (environmentVariables) =>
|
||||
if not environmentVariables?
|
||||
return Promise.reject(new Error('Not found'))
|
||||
|
||||
return _.reject(environmentVariables, isSystemVariable)
|
||||
return environmentVariables
|
||||
|
Loading…
Reference in New Issue
Block a user