mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-05-28 13:34:13 +00:00
Add non interactive support for app:create
This commit is contained in:
parent
f4ad73d2f8
commit
f0e25589cd
@ -10,15 +10,24 @@ applicationModel = require('../models/application')
|
||||
authHooks = require('../hooks/auth')
|
||||
config = require('../config')
|
||||
|
||||
exports.create = authHooks.failIfNotLoggedIn (name) ->
|
||||
exports.create = authHooks.failIfNotLoggedIn (name, program) ->
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
deviceTypes = device.getSupportedDevices()
|
||||
widgets.select('Select a type', deviceTypes, callback)
|
||||
deviceType = program.parent.type
|
||||
|
||||
if deviceType?
|
||||
return callback(null, deviceType)
|
||||
else
|
||||
deviceTypes = device.getSupportedDevices()
|
||||
widgets.select('Select a type', deviceTypes, callback)
|
||||
|
||||
(type, callback) ->
|
||||
|
||||
# TODO: Currently returns 'unknown'.
|
||||
# Maybe we should break or handle better?
|
||||
slugifiedType = device.getDeviceSlug(type)
|
||||
|
||||
applicationModel.create(name, slugifiedType).then ->
|
||||
return callback()
|
||||
.catch(callback)
|
||||
|
@ -9,6 +9,7 @@ program.version(packageJSON.version)
|
||||
# ---------- Options ----------
|
||||
program.option('-y, --yes', 'Confirm non interactively')
|
||||
program.option('-q, --quiet', 'quiet (no output)')
|
||||
program.option('-t, --type <type>', 'specify a type when creating an application')
|
||||
|
||||
# ---------- Auth Module ----------
|
||||
auth = require('./actions/auth')
|
||||
|
Loading…
x
Reference in New Issue
Block a user