[Groonga-commit] groonga/gcs [master] Add "--force" option to delete index field and use it from tests

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Aug 27 16:31:37 JST 2012


YUKI Hiroshi	2012-08-27 16:31:37 +0900 (Mon, 27 Aug 2012)

  New Revision: 7767e02b08b3a1224eee5928f1fb12bfa9638b6a
  https://github.com/groonga/gcs/commit/7767e02b08b3a1224eee5928f1fb12bfa9638b6a

  Log:
    Add "--force" option to delete index field and use it from tests

  Modified files:
    bin/gcs-configure-fields
    test/gcs-commands.test.js

  Modified: bin/gcs-configure-fields (+16 -9)
===================================================================
--- bin/gcs-configure-fields    2012-08-27 16:25:05 +0900 (ed06a9b)
+++ bin/gcs-configure-fields    2012-08-27 16:31:37 +0900 (ae79f8e)
@@ -46,15 +46,22 @@ if (commandLine.options.delete) {
     console.log('You must specify an existing field.');
     return process.exit(1);
   }
-  commandLine.confirm('Really delete? [' + field.name + '] (y/N) ', function(ok){
-    if (ok) {
-      field.deleteSync();
-      console.log('Updated 1 Index Field:');
-      process.exit(0);
-    } else {
-      process.exit(1);
-    }
-  });
+  var doDelete = function() {
+    field.deleteSync();
+    console.log('Updated 1 Index Field:');
+  };
+  if (commandLine.options.force) {
+    doDelete();
+  } else {
+    commandLine.confirm('Really delete? [' + field.name + '] (y/N) ', function(ok){
+      if (ok) {
+        doDelete();
+        process.exit(0);
+      } else {
+        process.exit(1);
+      }
+    });
+  }
 } else {
   if (!field.exists()) {
     if (!commandLine.options.type) {

  Modified: test/gcs-commands.test.js (+2 -0)
===================================================================
--- test/gcs-commands.test.js    2012-08-27 16:25:05 +0900 (a9a62da)
+++ test/gcs-commands.test.js    2012-08-27 16:31:37 +0900 (a25f653)
@@ -340,6 +340,7 @@ suite('gcs-configure-fields', function() {
            '--domain-name', 'companies',
            '--name', name,
            '--delete',
+           '--force',
            '--database-path', temporaryDatabase.path)
       .next(function(result) {
         assert.deepEqual({ code:    result.code,
@@ -411,6 +412,7 @@ suite('gcs-configure-fields', function() {
            '--domain-name', 'companies',
            '--name', 'name',
            '--delete',
+           '--force',
            '--database-path', temporaryDatabase.path)
       .next(function(result) {
         assert.deepEqual({ code:    result.code,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index