class Appfront::CLI

Public Class Methods

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

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

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

    opts.on("-p", "--provider Provider", "Specify the provider involved") do |v|
      options[:provider] = v
    end

    opts.on("-a", "--access Access Key", "Specify the access key involved") do |v|
      options[:access] = v
    end

    opts.on("-s", "--secret Secret Key", "Specify the secret key involved") do |v|
      options[:secret] = v
    end

    opts.on("-y", "--yaml File", "Specify the yaml file to upload") do |v|
      options[:yaml] = v
    end

    opts.on("-t", "--tail", "Continue running and print new events (off)") do |v|
      options[:follow] = 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/appfront/cli.rb, line 50
def self.run(args)
  cmd, opts = parse ARGV
  Appfront::Command.run cmd, opts
end