class MarsBase10::CLI

Handle the application command line parsing and the dispatch to various command objects

@api public

Constants

Error

Error raised by this runner

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/mars_base_10/cli.rb, line 18
def self.exit_on_failure?
  true
end

Public Instance Methods

help(*args) click to toggle source
Calls superclass method
# File lib/mars_base_10/cli.rb, line 24
def help(*args)
  font = TTY::Font.new(:standard)
  pastel = Pastel.new(enabled: !options["no-color"])
  puts pastel.yellow(font.write("Mars Base 10"))
  super
end
launch(config) click to toggle source
# File lib/mars_base_10/cli.rb, line 37
def launch(config)
  if options[:help]
    invoke :help, ["launch"]
  else
    if (config)
      require_relative "comm_central"
      begin
        cc = MarsBase10::CommCentral.new config_filename: config
        cc.activate
      ensure
        cc.shutdown
      end
    else
     raise Error, "A SHIP_CONFIG is required to launch."
    end
  end
end
version() click to toggle source
# File lib/mars_base_10/cli.rb, line 58
def version
  require_relative "version"
  puts "v#{MarsBase10::VERSION}"
end