Module: Kik

Defined in:
lib/kik.rb,
lib/kik/runner.rb,
lib/kik/version.rb

Defined Under Namespace

Classes: Runner

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.start(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kik.rb', line 7

def self.start(args)
  options = {}
  OptionParser.new do |opts|
    opts.banner = "Usage: example.rb [options]"
    opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
      options[:verbose] = v
    end
    opts.on("-p", "--port=PORT", "Specify port to check") do |p|
      options[:port] = p
    end
  end.parse!(args.clone)

  command_index = args.find_index('--')
  raise 'command must be provided after --' unless command_index

  command = args.slice(command_index + 1, args.count)

  Runner.new(options[:port], options[:verbose], command).start
end