[Groonga-commit] groonga/groonga-command-parser at c10a1f7 [master] groonga-command-convert-format: add a new format option (#2)

アーカイブの一覧に戻る
Yasuhiro Horimoto null+****@clear*****
Wed Mar 20 18:49:30 JST 2019


Yasuhiro Horimoto	2019-03-20 18:49:30 +0900 (Wed, 20 Mar 2019)

  Revision: c10a1f7d804f31269e2acf312cdde97c1bb92186
  https://github.com/groonga/groonga-command-parser/commit/c10a1f7d804f31269e2acf312cdde97c1bb92186

  Message:
    groonga-command-convert-format: add a new format option (#2)
    
    * groonga-command-convert-format: add a new format option
    
    This option converts Groonga's dump format to Elasticsearch's import format.
    This feature needs to groonga/groonga-command#10.
    
    * Add a missing end
    
    * Add a describe about a supported the Elasticsearch version
    
    * Fix a typo
    
    * gemspec: update the required groonga-command version

  Modified files:
    groonga-command-parser.gemspec
    lib/groonga/command/parser/command/groonga-command-convert-format.rb

  Modified: groonga-command-parser.gemspec (+1 -1)
===================================================================
--- groonga-command-parser.gemspec    2019-03-06 14:19:28 +0900 (fee8926)
+++ groonga-command-parser.gemspec    2019-03-20 18:49:30 +0900 (fd46757)
@@ -52,7 +52,7 @@ Gem::Specification.new do |spec|
   spec.licenses = ["LGPLv2.1+"]
   spec.require_paths = ["lib"]
 
-  spec.add_runtime_dependency("groonga-command", ">= 1.3.2")
+  spec.add_runtime_dependency("groonga-command", ">= 1.4.0")
   spec.add_runtime_dependency("json-stream")
 
   spec.add_development_dependency("test-unit")

  Modified: lib/groonga/command/parser/command/groonga-command-convert-format.rb (+15 -1)
===================================================================
--- lib/groonga/command/parser/command/groonga-command-convert-format.rb    2019-03-06 14:19:28 +0900 (62413b4)
+++ lib/groonga/command/parser/command/groonga-command-convert-format.rb    2019-03-20 18:49:30 +0900 (7e15707)
@@ -27,6 +27,7 @@ module Groonga
             @format = :command
             @uri_prefix = "http://localhost:10041"
             @pretty_print = true
+            @elasticsearch_version = 5
           end
 
           def run(argv=ARGV)
@@ -57,7 +58,7 @@ module Groonga
             option_parser.banner += " INPUT_PATH1 INPUT_PATH2 ..."
             option_parser.version = VERSION
 
-            formats = [:uri, :command]
+            formats = [:uri, :command, :elasticsearch]
             option_parser.on("--format=FORMAT", formats,
                              "Convert to FORMAT",
                              "Available formats #{formats.join(', ')}",
@@ -78,6 +79,17 @@ module Groonga
               @pretty_print = boolean
             end
 
+            option_parser.on("--elasticsearch-version=VERSION",
+                             "Specify the Elasticsearch version",
+                             "Because the Elasticsearch's import format" +
+                                        " differs depending on version",
+                             "Currently, we can specify 5, 6, 7, and 8" +
+                                                      " in this option",
+                             "Available only in elasticsearch format",
+                             "[#{@elasticsearch_version}]") do |version|
+              @elasticsearch_version = version
+            end
+
             option_parser.parse!(argv)
           end
 
@@ -96,6 +108,8 @@ module Groonga
             case @format
             when :uri
               "#{@uri_prefix}#{command.to_uri_format}"
+            when :elasticsearch
+              command.to_elasticsearch_format(:version => @elasticsearch_version)
             else
               command.to_command_format(:pretty_print => @pretty_print)
             end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190320/b8a9c191/attachment-0001.html>


More information about the Groonga-commit mailing list
アーカイブの一覧に戻る