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
41
# File 'lib/opsworks/cli.rb', line 5

def self.start
  spec = Gem::Specification::load(File.expand_path(
    "../../../opsworks.gemspec",
    Pathname.new(__FILE__).realpath,
  ))

  commands = %w(ssh)

  global_opts = Trollop::options do
    version "opsworks #{spec.version} (c) #{spec.authors.join(", ")}"
    banner <<-EOS.unindent
      usage: opsworks [COMMAND] [OPTIONS...]

      #{spec.summary}

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

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

      Options:
    EOS
    stop_on commands
  end

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

end