Class: LolDba::CLI
- Inherits:
-
Object
- Object
- LolDba::CLI
- Defined in:
- lib/lol_dba/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, options) ⇒ CLI
constructor
A new instance of CLI.
- #start(arg) ⇒ Object
Constructor Details
#initialize(path, options) ⇒ CLI
Returns a new instance of CLI.
27 28 29 30 |
# File 'lib/lol_dba/cli.rb', line 27 def initialize(path, ) @path = path = end |
Class Method Details
.parse_options ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lol_dba/cli.rb', line 11 def = {} OptionParser.new do |opts| opts.on('-d', '--debug', 'Show stack traces when an error occurs.') do |opt| [:debug] = opt end opts.on_tail('-v', '--version', 'Show version') do puts LolDba::VERSION exit end end.parse! end |
.start ⇒ Object
7 8 9 |
# File 'lib/lol_dba/cli.rb', line 7 def start new(Dir.pwd, ).start(ARGV.first) end |
Instance Method Details
#start(arg) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lol_dba/cli.rb', line 32 def start(arg) load_application select_action(arg) rescue SystemExit raise $! rescue Exception => exception if [:debug] warn "Failed: #{exception.class}: #{exception.message}" warn exception.backtrace.map { |trace| " from #{trace}" } end end |