Class: Sanford::CLI
- Inherits:
-
Object
- Object
- Sanford::CLI
- Defined in:
- lib/sanford/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
Class Method Details
.run(args) ⇒ Object
11 12 13 |
# File 'lib/sanford/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/sanford/cli.rb', line 20 def run(*args) begin run!(*args) rescue CLIRB::HelpExit @kernel.puts help rescue CLIRB::VersionExit @kernel.puts Sanford::VERSION rescue CLIRB::Error, Sanford::ConfigFile::InvalidError => exception @kernel.puts "#{exception.}\n\n" @kernel.puts help @kernel.exit 1 rescue StandardError => exception @kernel.puts "#{exception.class}: #{exception.}" @kernel.puts exception.backtrace.join("\n") @kernel.exit 1 end @kernel.exit 0 end |