class ElasticDot::CLI

Public Class Methods

parse(args) click to toggle source
# File lib/elasticdot/cli.rb, line 10
def self.parse(args)
  options = {}

  opt_parser = OptionParser.new do |opts|
    opts.banner = "Usage: example.rb [options]"

    opts.on("-a", "--app APP", "Specify the app involved") do |v|
      options[:app] = v
    end

    opts.on("-d", "--database DATABASE", "Specify the database involved") do |v|
      options[:db] = v
    end

    opts.on("-f", "--follow", "Continue running and print new events (off)") do |v|
      options[:follow] = v
    end

    opts.on("-p", "--plan PLAN", "Specify pricing plan") do |v|
      options[:plan] = v
    end

    opts.on("-c", "--extra-conf CONF", "Specify extra config file") do |v|
      options[:conf] = v
    end

    opts.on("-h", "--help", "Show this help") do |v|
      options[:help] = true
    end
  end

  opt_parser.parse! args

  [ARGV, options]
end
run(args) click to toggle source
# File lib/elasticdot/cli.rb, line 46
def self.run(args)
  cmd, opts = parse ARGV
  ElasticDot::Command.run cmd, opts
end