Class: MarsBase10::CLI
- Inherits:
-
Thor
- Object
- Thor
- MarsBase10::CLI
- Defined in:
- lib/mars_base_10/cli.rb
Overview
Handle the application command line parsing and the dispatch to various command objects
Constant Summary collapse
- Error =
Error raised by this runner
Class.new(StandardError)
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
18 19 20 |
# File 'lib/mars_base_10/cli.rb', line 18 def self.exit_on_failure? true end |
Instance Method Details
#help(*args) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/mars_base_10/cli.rb', line 24 def help(*args) font = TTY::Font.new(:standard) pastel = Pastel.new(enabled: !["no-color"]) puts pastel.yellow(font.write("Mars Base 10")) super end |
#launch(config) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mars_base_10/cli.rb', line 37 def launch(config) if [:help] invoke :help, ["launch"] else if (config) require_relative "mission_control" begin cc = MarsBase10::MissionControl.new config_filename: config cc.activate ensure cc.shutdown end else raise Error, "A SHIP_CONFIG is required to launch." end end end |
#version ⇒ Object
58 59 60 61 |
# File 'lib/mars_base_10/cli.rb', line 58 def version require_relative "version" puts "v#{MarsBase10::VERSION}" end |