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