Browse files

[api] always prompts on app destruction

  • Loading branch information...
1 parent 23cb2e6 commit 3e1880651d575cf7ef173e88b6340eb2430d259f @blakmatrix blakmatrix committed Jan 14, 2013
Showing with 16 additions and 18 deletions.
  1. +16 −18 lib/jitsu/commands/apps.js
View
34 lib/jitsu/commands/apps.js
@@ -543,40 +543,38 @@ apps.update.usage = [
//
apps.destroy = function (name, callback) {
-//
+ //
// Allows arbitrary amount of arguments
//
if(arguments.length) {
var args = utile.args(arguments);
callback = args.callback;
name = args[0] || null;
}
-
- function executeDestroy() {
- jitsu.log.info('Destroying app ' + name.magenta);
- jitsu.apps.destroy(name, function (err) {
- jitsu.log.silly('Done destroying app ' + name.magenta);
- return err ? callback(err) : callback();
- });
- }
-
if (!name) {
jitsu.package.tryRead(process.cwd(), callback, function (pkg) {
jitsu.log.info('Attempting to destroy app ' + pkg.name.magenta);
name = pkg.name;
- jitsu.prompt.confirm('yes/no', function(err, result){
- if (result) {
- executeDestroy();
- } else {
- jitsu.log.info('app ' + pkg.name.magenta + ' was not destroyed');
- callback(null);
- }
- });
+ executeDestroy();
});
} else {
executeDestroy();
}
+ function executeDestroy() {
+ jitsu.log.info('Destroy app ' + name.magenta);
+ jitsu.prompt.confirm('yes/no', { default: 'yes'}, function(err, result){
+ if (result) {
+ jitsu.apps.destroy(name, function (err) {
+ jitsu.log.silly('Done destroying app ' + name.magenta);
+ return err ? callback(err) : callback();
+ });
+ } else {
+ jitsu.log.info('app ' + name.magenta + ' was not destroyed');
+ callback(null);
+ }
+ });
+ }
};
//

0 comments on commit 3e18806

Please sign in to comment.