Method: FWC.parser

Defined in:
lib/fwc.rb

.parserObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/fwc.rb', line 70

def self.parser
  @@parser ||= OptionParser.new do |o|
    o.banner = "Usage: fwc [options]"

    o.on "-d", "--[no-]debug" do |d|
      opts[:debug] = d
    end

    o.on "-s", "--summary", "Show a periodic summary of everything seen" do
      opts[:summary] = true
    end

    o.on "-r", "--raw", "Display raw metrics and events, as soon as they are seen" do
      opts[:raw] = true
    end

    o.on "--raw-threshold <rate>", "Limit of how many messages/s is allowed before disabling output" do |d|
      opts[:raw_threshold] = d.to_i
    end

    o.on "-i", "--report-interval", "Interval in seconds to generate report" do |d|
      opts[:report_interval] = d.to_i
    end

    o.on "--key <key>", "Only handle events and metrics matching the specified key" do |d|
      opts[:key] = d
    end

    o.on "--tag <tag>", "Only handle event and metrics which matches the specified tag" do |d|
      opts[:tags] ||= []
      opts[:tags] << d
    end
  end
end