[Groonga-commit] droonga/droonga-client-ruby at d6f497d [master] Accept multiple input files

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Feb 20 16:01:42 JST 2014


YUKI Hiroshi	2014-02-20 16:01:42 +0900 (Thu, 20 Feb 2014)

  New Revision: d6f497deb28471b7c3c2f1cd5c8f632c3f4e7f46
  https://github.com/droonga/droonga-client-ruby/commit/d6f497deb28471b7c3c2f1cd5c8f632c3f4e7f46

  Message:
    Accept multiple input files

  Modified files:
    bin/droonga-request

  Modified: bin/droonga-request (+8 -8)
===================================================================
--- bin/droonga-request    2014-02-20 15:57:56 +0900 (0de3885)
+++ bin/droonga-request    2014-02-20 16:01:42 +0900 (2ccb6fe)
@@ -96,9 +96,7 @@ parser.on("--[no-]report-elapsed-time",
           "(#{options[:report_elapsed_time]})") do |report_elapsed_time|
   options[:report_elapsed_time] = report_elapsed_time
 end
-rest = parser.parse!(ARGV)
-
-request_json_file = rest.first
+request_json_files = parser.parse!(ARGV)
 
 client = Droonga::Client.new(options)
 json_parser = Yajl::Parser.new
@@ -124,10 +122,12 @@ json_parser.on_parse_complete = lambda do |request_message|
   request.wait
 end
 
-if request_json_file
-  File.open(request_json_file) do |input|
-    json_parser.parse(input)
-  end
-else
+if request_json_files.empty?
   json_parser.parse($stdin)
+else
+  request_json_files.each do |request_json_file|
+    File.open(request_json_file) do |input|
+      json_parser.parse(input)
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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