Class: Freighthop::CLI

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

Defined Under Namespace

Classes: Checks, Help, Init, SSH, Vagrant, Version

Constant Summary collapse

COMMANDS =
[
  Freighthop::CLI::Version,
  Freighthop::CLI::Help,
  Freighthop::CLI::Init,
  Freighthop::CLI::Vagrant,
  Freighthop::CLI::SSH
]

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



19
20
21
# File 'lib/freighthop/cli.rb', line 19

def initialize(*args)
  @args = args
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
# File 'lib/freighthop/cli.rb', line 23

def run
  Freighthop::VagrantEnv.activate!

  command = COMMANDS.detect { |c| c.match?(*@args) }
  # no need for a nil check, because CLI::SSH will always match
  command.new(*@args).run
end