Skip to content

Commit

Permalink
Delete duplicated codes
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Oct 15, 2012
1 parent 645b80a commit f18b99d
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions bin/gcs-delete-domain
Expand Up @@ -14,34 +14,26 @@ commandLine

commandLine.assertHaveDomainName();
commandLine.assertDomainExistsHTTP(function() {
if (commandLine.options.force) {
function doDelete(successMessage) {
commandLine.cloudSearch.DeleteDomain(
{ DomainName: commandLine.domainName },
function(error, response) {
if (error) {
console.log('Unexpected error: ' + JSON.stringify(error));
process.exit(1);
} else {
console.log('Domain [' + commandLine.domainName + '] has been deleted successfully.');
console.log(successMessage);
process.exit(0);
}
}
});
}
if (commandLine.options.force) {
doDelete('Domain [' + commandLine.domainName + '] has been deleted successfully.');
} else {
commandLine.confirm('Really delete? [' + commandLine.domainName + '] (y/N) ', function(ok){
if (ok) {
commandLine.cloudSearch.DeleteDomain(
{ DomainName: commandLine.domainName },
function(error, response) {
if (error) {
console.log('Unexpected error: ' + JSON.stringify(error));
process.exit(1);
} else {
console.log('Successfully deleted.');
process.exit(0);
}
}
});
doDelete('Successfully deleted.');
} else {
process.exit(1);
}
Expand Down

0 comments on commit f18b99d

Please sign in to comment.