[Groonga-commit] droonga/droonga-client-ruby at af9dd3a [master] Show help document if no command name is given

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 15 16:28:47 JST 2015


YUKI Hiroshi	2015-04-15 16:28:47 +0900 (Wed, 15 Apr 2015)

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

  Message:
    Show help document if no command name is given

  Modified files:
    bin/droonga-groonga

  Modified: bin/droonga-groonga (+9 -6)
===================================================================
--- bin/droonga-groonga    2015-04-15 16:25:49 +0900 (422b9ab)
+++ bin/droonga-groonga    2015-04-15 16:28:47 +0900 (7f6f5cf)
@@ -39,12 +39,12 @@ module Droonga
                     :default => false)
         end
 
-        groonga_command_name = ARGV.shift
-        assert_valid_command(groonga_command_name)
+        @command = ARGV.shift
+        assert_valid_command
 
         groonga_message = {
           "dataset" => @options[:dataset],
-          "type" => groonga_command_name,
+          "type" => @command,
           "body" => build_params(ARGV),
         }
 
@@ -58,12 +58,15 @@ module Droonga
         end
 
         exit(true)
+      rescue InvalidCommandName, MissingCommandName
+        puts(@options)
+        exit(true)
       end
 
       private
-      def assert_valid_command(command)
-        raise InvalidCommandName.new(command) if /\A--.+\z/ =~ command
-        raise MissingCommandName.new if command.nil?
+      def assert_valid_command
+        raise InvalidCommandName.new(@command) if /\A--.+\z/ =~ @command
+        raise MissingCommandName.new if****@comma*****?
       end
 
       def build_params(argv)
-------------- next part --------------
HTML����������������������������...
다운로드 



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