Sha256: f8b7565d14dcd0f22c1def1637726c0d6e0d1e78102813caa2c526fac65bbeef

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

module Pione
  module Option
    # CommonOption provides common options for pione commands.
    module CommonOption
      extend OptionInterface

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

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

      # --color
      option('--[no-]color', 'turn on/off color mode') do |data, 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

2 entries across 2 versions & 1 rubygems

Version Path
pione-0.1.4 lib/pione/option/common-option.rb
pione-0.1.3 lib/pione/option/common-option.rb