mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 22:47:48 +00:00
Merge pull request #174 from resin-io/jviotti/feature/confirm-abortion
Add `Aborted` error message when not accepting a confirmation
This commit is contained in:
commit
d10d4ce185
@ -80,10 +80,7 @@
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return helpers.confirm(option.yes, 'Are you sure you want to delete the application?').then(function(confirmed) {
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the application?').then(function() {
|
||||
return resin.models.application.remove(params.name);
|
||||
}).nodeify(done);
|
||||
}
|
||||
@ -106,10 +103,7 @@
|
||||
var message;
|
||||
message = "Are you sure you want to associate " + currentDirectory + " with " + params.name + "?";
|
||||
return helpers.confirm(options.yes, message);
|
||||
}).then(function(confirmed) {
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
}).then(function() {
|
||||
return resin.models.application.get(params.name).get('git_repository').then(function(gitRepository) {
|
||||
return vcs.initialize(currentDirectory).then(function() {
|
||||
return vcs.associate(currentDirectory, gitRepository);
|
||||
|
@ -75,10 +75,7 @@
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the device?').then(function(confirmed) {
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the device?').then(function() {
|
||||
return resin.models.device.remove(params.uuid);
|
||||
}).nodeify(done);
|
||||
}
|
||||
|
@ -56,10 +56,7 @@
|
||||
options: [commandOptions.yes, commandOptions.booleanDevice],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the environment variable?').then(function(confirmed) {
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the environment variable?').then(function() {
|
||||
if (options.device) {
|
||||
return resin.models.environmentVariables.device.remove(params.id);
|
||||
} else {
|
||||
|
@ -49,10 +49,7 @@
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the key?').then(function(confirmed) {
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
return helpers.confirm(options.yes, 'Are you sure you want to delete the key?').then(function() {
|
||||
return resin.models.key.remove(params.id);
|
||||
}).nodeify(done);
|
||||
}
|
||||
|
@ -23,6 +23,10 @@
|
||||
type: 'confirm',
|
||||
"default": false
|
||||
});
|
||||
}).then(function(confirmed) {
|
||||
if (!confirmed) {
|
||||
throw new Error('Aborted');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -125,8 +125,7 @@ exports.remove =
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
helpers.confirm(option.yes, 'Are you sure you want to delete the application?').then (confirmed) ->
|
||||
return if not confirmed
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the application?').then ->
|
||||
resin.models.application.remove(params.name)
|
||||
.nodeify(done)
|
||||
|
||||
@ -157,9 +156,7 @@ exports.associate =
|
||||
.then ->
|
||||
message = "Are you sure you want to associate #{currentDirectory} with #{params.name}?"
|
||||
helpers.confirm(options.yes, message)
|
||||
|
||||
.then (confirmed) ->
|
||||
return if not confirmed
|
||||
.then ->
|
||||
|
||||
resin.models.application.get(params.name).get('git_repository').then (gitRepository) ->
|
||||
vcs.initialize(currentDirectory).then ->
|
||||
|
@ -105,8 +105,7 @@ exports.remove =
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the device?').then (confirmed) ->
|
||||
return if not confirmed
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the device?').then ->
|
||||
resin.models.device.remove(params.uuid)
|
||||
.nodeify(done)
|
||||
|
||||
|
@ -82,9 +82,7 @@ exports.remove =
|
||||
]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the environment variable?').then (confirmed) ->
|
||||
return if not confirmed
|
||||
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the environment variable?').then ->
|
||||
if options.device
|
||||
resin.models.environmentVariables.device.remove(params.id)
|
||||
else
|
||||
|
@ -67,8 +67,7 @@ exports.remove =
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the key?').then (confirmed) ->
|
||||
return if not confirmed
|
||||
helpers.confirm(options.yes, 'Are you sure you want to delete the key?').then ->
|
||||
resin.models.key.remove(params.id)
|
||||
.nodeify(done)
|
||||
|
||||
|
@ -21,3 +21,6 @@ exports.confirm = (yesOption, message) ->
|
||||
message: message
|
||||
type: 'confirm'
|
||||
default: false
|
||||
.then (confirmed) ->
|
||||
if not confirmed
|
||||
throw new Error('Aborted')
|
||||
|
Loading…
Reference in New Issue
Block a user