YUKI Hiroshi
null+****@clear*****
Mon Oct 15 16:35:09 JST 2012
YUKI Hiroshi 2012-10-15 16:35:09 +0900 (Mon, 15 Oct 2012) New Revision: f18b99de712991cfe3ec0220b4e7b60780faaf37 https://github.com/groonga/gcs/commit/f18b99de712991cfe3ec0220b4e7b60780faaf37 Log: Delete duplicated codes Modified files: bin/gcs-delete-domain Modified: bin/gcs-delete-domain (+6 -14) =================================================================== --- bin/gcs-delete-domain 2012-10-15 16:30:36 +0900 (09e11b8) +++ bin/gcs-delete-domain 2012-10-15 16:35:09 +0900 (99d58bf) @@ -14,7 +14,7 @@ commandLine commandLine.assertHaveDomainName(); commandLine.assertDomainExistsHTTP(function() { - if (commandLine.options.force) { + function doDelete(successMessage) { commandLine.cloudSearch.DeleteDomain( { DomainName: commandLine.domainName }, function(error, response) { @@ -22,26 +22,18 @@ commandLine.assertDomainExistsHTTP(function() { 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); } -------------- next part -------------- HTML����������������������������... Download