Class: Madness::CommandLine

Inherits:
Object
  • Object
show all
Includes:
Colsole, Singleton
Defined in:
lib/madness/command_line.rb

Overview

Handle command line execution. Used by bin/madness.

Instance Method Summary collapse

Instance Method Details

#execute(argv = []) ⇒ Object

Process ARGV by putting it through docopt



14
15
16
17
18
19
20
21
22
23
# File 'lib/madness/command_line.rb', line 14

def execute(argv=[])
  doc = File.read File.expand_path('docopt.txt', __dir__)
  
  begin
    args = Docopt.docopt(doc, argv: argv, version: VERSION)
    handle args
  rescue Docopt::Exit => e
    puts e.message
  end
end