mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-03-21 11:35:54 +00:00
Remove duplication by relying on Capitano's new required option feature
This commit is contained in:
parent
dc75481880
commit
d2b0772673
@ -7,9 +7,6 @@ errors = require('../errors/errors')
|
||||
permissions = require('../permissions/permissions')
|
||||
|
||||
exports.list = permissions.user (params, options) ->
|
||||
if not options.application?
|
||||
errors.handle(new Error('You have to specify an application'))
|
||||
|
||||
resin.models.device.getAllByApplication options.application, (error, devices) ->
|
||||
errors.handle(error) if error?
|
||||
|
||||
|
@ -11,9 +11,6 @@ isSystemVariable = (environmentVariable) ->
|
||||
SYSTEM_VAR_REGEX.test(environmentVariable.name)
|
||||
|
||||
exports.list = permissions.user (params, options) ->
|
||||
if not options.application?
|
||||
errors.handle(new Error('You have to specify an application'))
|
||||
|
||||
resin.models.environmentVariables.getAllByApplication options.application, (error, environmentVariables) ->
|
||||
errors.handle(error) if error?
|
||||
|
||||
@ -28,9 +25,6 @@ exports.remove = permissions.user (params, options) ->
|
||||
, errors.handle
|
||||
|
||||
exports.add = permissions.user (params, options) ->
|
||||
if not options.application?
|
||||
errors.handle(new Error('You have to specify an application'))
|
||||
|
||||
if not params.value?
|
||||
params.value = process.env[params.key]
|
||||
|
||||
|
@ -4,7 +4,6 @@ path = require('path')
|
||||
mkdirp = require('mkdirp')
|
||||
ProgressBar = require('progress')
|
||||
resin = require('resin-sdk')
|
||||
connection = require('../connection/connection')
|
||||
log = require('../log/log')
|
||||
permissions = require('../permissions/permissions')
|
||||
errors = require('../errors/errors')
|
||||
|
@ -58,6 +58,7 @@ applicationOption =
|
||||
parameter: 'application'
|
||||
description: 'application id'
|
||||
alias: [ 'a', 'app' ]
|
||||
required: 'You have to specify an application'
|
||||
|
||||
deviceOption =
|
||||
signature: 'device'
|
||||
|
@ -47,7 +47,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.9.0",
|
||||
"capitano": "~1.0.4",
|
||||
"capitano": "~1.1.0",
|
||||
"cliff": "~0.1.9",
|
||||
"coffee-script": "~1.8.0",
|
||||
"conf.js": "^0.1.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user