mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 13:47:52 +00:00
Merge pull request #66 from resin-io/feature/device-init-has-app
Check that the passed application exists before asking to choose device
This commit is contained in:
commit
6d8fd6e547
@ -188,6 +188,11 @@
|
||||
return vcs.getApplicationName(process.cwd(), callback);
|
||||
}, function(applicationName, callback) {
|
||||
options.application = applicationName;
|
||||
return resin.models.application.has(options.application, callback);
|
||||
}, function(hasApplication, callback) {
|
||||
if (!hasApplication) {
|
||||
return callback(new Error("Invalid application: " + options.application));
|
||||
}
|
||||
if (params.device != null) {
|
||||
return callback(null, params.device);
|
||||
}
|
||||
|
@ -265,6 +265,12 @@ exports.init =
|
||||
|
||||
(applicationName, callback) ->
|
||||
options.application = applicationName
|
||||
resin.models.application.has(options.application, callback)
|
||||
|
||||
(hasApplication, callback) ->
|
||||
if not hasApplication
|
||||
return callback(new Error("Invalid application: #{options.application}"))
|
||||
|
||||
return callback(null, params.device) if params.device?
|
||||
visuals.patterns.selectDrive(callback)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user