Class: Appfront::CLI

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

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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) ⇒ Object



50
51
52
53
# File 'lib/appfront/cli.rb', line 50

def self.run(args)
  cmd, opts = parse ARGV
  Appfront::Command.run cmd, opts
end