[Groonga-commit] droonga/droonga-client-ruby at 31a8f7a [master] Add "--pretty" option for droonga-system-status command

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 15 15:58:27 JST 2015


YUKI Hiroshi	2015-04-15 15:58:27 +0900 (Wed, 15 Apr 2015)

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

  Message:
    Add "--pretty" option for droonga-system-status command

  Modified files:
    bin/droonga-system-status

  Modified: bin/droonga-system-status (+14 -2)
===================================================================
--- bin/droonga-system-status    2015-04-15 15:54:32 +0900 (83b91b2)
+++ bin/droonga-system-status    2015-04-15 15:58:27 +0900 (b9c34fa)
@@ -23,10 +23,22 @@ module Droonga
   module Command
     class SystemStatus < Base
       def run
-        parse_options
+        parse_options do |option|
+          option.on(:pretty,
+                    "Output result as a pretty print JSON.",
+                    :default => false)
+        end
+
         response = client.request("dataset" => @options[:dataset],
                                   "type"    => "system.status")
-        puts(JSON.generate(response["body"]))
+        body = response["body"]
+
+        if @option[:pretty]
+          puts(JSON.pretty_generate(body))
+        else
+          puts(JSON.generate(body))
+        end
+
         exit(true)
       end
     end
-------------- next part --------------
HTML����������������������������...
Descargar 



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