Sha256: 893f05888f585822705e02ede3510f57f31f24ae4d9bcafc9b2f1d34aaa8410a

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

module Pione
  module CommandOption
    module CommonOption
      extend OptionInterface

      # --debug
      define_option('-d', '--debug', "turn on debug mode") do |name|
        Pione.debug_mode = true
      end

      # --show-communication
      define_option('--show-communication', "show object communication") do |show|
        Global.show_communication = true
      end

      # --color
      define_option('--[no-]color', 'turn on/off color mode') do |str|
        bool = nil
        bool = true if str == "true"
        bool = false if str == "false"
        if bool.nil?
          puts "invalid color option: %s" % bool
          exit
        end
        Terminal.color_mode = bool
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pione-0.1.2 lib/pione/command-option/common-option.rb
pione-0.1.1 lib/pione/command-option/common-option.rb
pione-0.1.0 lib/pione/command-option/common-option.rb