Allow increasing verbosity for envs command

This commit is contained in:
Juan Cruz Viotti 2014-11-24 12:43:37 -04:00
parent a8a78f0749
commit 7988b0cbbe
3 changed files with 12 additions and 9 deletions

View File

@ -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

View File

@ -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')

View File

@ -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