Class: Command

Inherits:
PangeaCommand show all
Defined in:
lib/pangea/cli/subcommands/main.rb

Overview

cli entrypoint

Instance Method Summary collapse

Instance Method Details

#helpObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pangea/cli/subcommands/main.rb', line 22

def help
  <<~HELP
    Usage: pangea command [OPTIONS] SUBCOMMAND

    Arguments:
      SUBCOMMAND  subcommand for pangea

    Options:
      -h, --help     Print usage
      -v, --version  Print version

    Subcommands:
      infra   manage infrastructure
      config  manage configuration
  HELP
end

#runObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/pangea/cli/subcommands/main.rb', line 39

def run
  argv = ARGV
  parse(argv)

  case params[:subcommand].to_s
  when %(infra)
    InfraCommand.new.run(argv)
  when %(config)
    ConfigCommand.new.run(argv)
  else
    if params[:version]
      puts Pangea::VERSION
    else
      puts help
    end
    exit
  end
end