Class: RubyMaat::CLI
- Inherits:
-
Object
- Object
- RubyMaat::CLI
- Defined in:
- lib/ruby_maat/cli.rb
Overview
Command Line Interface - Ruby port of code-maat.cmd-line
Constant Summary collapse
- VERSION_INFO =
"Ruby Maat version #{RubyMaat::VERSION} - A Ruby port of Code Maat".freeze
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(args) ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
15 16 17 18 |
# File 'lib/ruby_maat/cli.rb', line 15 def initialize = {} @parser = build_option_parser end |
Instance Method Details
#run(args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ruby_maat/cli.rb', line 20 def run(args) @parser.parse!(args) if [:help] puts usage exit 0 end if [:generate_log] || [:interactive] handle_log_generation else app = App.new() app.run end rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e warn "Error: #{e.message}" warn usage exit 1 rescue ArgumentError => e warn "Error: #{e.message}" warn usage exit 1 rescue => e warn "Error: #{e.message}" warn e.backtrace.join("\n") if [:verbose] exit 1 end |