Module: Daneel::Options

Defined in:
lib/daneel/options.rb

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/daneel/options.rb', line 6

def self.parse(args)
  options = {}

  OptionParser.new do |opts|
    opts.banner = "Usage: daneel [options]"

    opts.on("-v", "--verbose", "Print debugging information") do |v|
      options[:verbose] = v
    end

    opts.on("-s", "--server [PORT]", "Run the HTTP server on PORT (default 3333)") do |port|
      options[:server] = {:port => port}
    end

    opts.on("-a", "--adapter ADAPTER", "Which interaction adapter to use") do |name|
      options[:adapter] = name
    end

    opts.on("-n", "--name NAME", "The name your bot should respond to") do |name|
      options[:name] = name
    end

    opts.on("-f", "--full-name FULLNAME", "The name your bot will use to refer to itself") do |name|
      options[:full_name] = name
    end
  end.parse(args)

  return options
end