[Groonga-commit] groonga/grntest [master] Translater: Use Shellwords to split arguments in command

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 5日 (火) 16:47:53 JST


Haruka Yoshihara	2012-06-05 16:47:53 +0900 (Tue, 05 Jun 2012)

  New Revision: 91dbf34c99937f22bdd505243b6398ff9276b8e6

  Log:
    Translater: Use Shellwords to split arguments in command

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+2 -4)
===================================================================
--- lib/groonga/tester.rb    2012-06-05 16:28:03 +0900 (0b12d00)
+++ lib/groonga/tester.rb    2012-06-05 16:47:53 +0900 (3bfa687)
@@ -622,9 +622,7 @@ module Groonga
 
         return command if command =~ /\A(?!\s+)\W/
 
-        command = command.gsub(/,\s/, ",")
-        arguments = command.split(/(\s'.+?'\s|\s)/).collect(&:strip)
-        now_command = arguments.shift
+        now_command, *arguments = Shellwords.split(command)
 
         translated_values = translate_arguments(now_command, arguments)
         translated_command =
@@ -659,7 +657,7 @@ module Groonga
             query_parameter = last_command
           end
 
-          value = argument.gsub(/'/, "")
+          value = argument.gsub(/\s/, "")
           translated_values =
             translated_values.merge(query_parameter => value)
           arguments_count += 1




Groonga-commit メーリングリストの案内
Back to archive index