Class: PipelineToolkit::CLI::MsgGeneratorCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/pipeline_toolkit/cli/msg_generator_cli.rb

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pipeline_toolkit/cli/msg_generator_cli.rb', line 10

def self.execute(stdout, arguments=[])

  opts = Trollop::options do
    banner <<-EOL
Message Subscriber
------------------
  Generates messages for testing the pipeline. Messages are specified 
  using JSON.

  Usage:
  msg_generator [options]

Examples:
  msg_generator -m '{"id":1, "firstName":"John Smith"}'

Options:
      EOL
    opt :msg, "The message to send", :short => "m", :default => '{"id":1}'
    opt :delay, "Sleep time between sends in seconds", :short => "d", :type => :float, :default => 1.0
    opt :limit, "Generate this number of messages and then exit. By default messages will keep generating indefinately", :short => "n", :type => :integer
  end

  MessageGenerator.new(opts).start
end