Class: OpsWorks::CLI

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

Class Method Summary collapse

Class Method Details

.startObject



5
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
35
36
37
38
39
40
# File 'lib/opsworks/cli.rb', line 5

def self.start
  commands = %w(ssh dsh)

  Trollop::options do
    version "opsworks #{OpsWorks::VERSION} " <<
            "(c) #{OpsWorks::AUTHORS.join(", ")}"
    banner <<-EOS.unindent
      usage: opsworks [COMMAND] [OPTIONS...]

      #{OpsWorks::SUMMARY}

      Commands
        ssh       #{OpsWorks::Commands::SSH.banner}
        dsh       #{OpsWorks::Commands::DSH.banner}

      For help with specific commands, run:
        opsworks COMMAND -h/--help

      Options:
    EOS
    stop_on commands
  end

  command = ARGV.shift
  case command
    when "ssh"
      OpsWorks::Commands::SSH.run
    when "dsh"
      OpsWorks::Commands::DSH.run
    when nil
      Trollop::die "no command specified"
    else
      Trollop::die "unknown command: #{command}"
  end

end