Class: Qs::CLI
- Inherits:
-
Object
- Object
- Qs::CLI
- Defined in:
- lib/qs/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(kernel = nil) ⇒ CLI
constructor
A new instance of CLI.
- #run(*args) ⇒ Object
Constructor Details
#initialize(kernel = nil) ⇒ CLI
15 16 17 18 |
# File 'lib/qs/cli.rb', line 15 def initialize(kernel = nil) @kernel = kernel || Kernel @cli = CLIRB.new end |
Class Method Details
.run(args) ⇒ Object
11 12 13 |
# File 'lib/qs/cli.rb', line 11 def self.run(args) self.new.run(*args) 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 |
# File 'lib/qs/cli.rb', line 20 def run(*args) begin run!(*args) rescue CLIRB::HelpExit @kernel.puts help rescue CLIRB::VersionExit @kernel.puts Qs::VERSION rescue CLIRB::Error, Qs::ConfigFile::InvalidError => exception @kernel.puts "#{exception.message}\n\n" @kernel.puts help @kernel.exit 1 rescue StandardError => exception @kernel.puts "#{exception.class}: #{exception.message}" @kernel.puts exception.backtrace.join("\n") @kernel.exit 1 end @kernel.exit 0 end |