Class: TomDoc::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/tomdoc/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.options(&block) ⇒ Object

DSL Magics



9
10
11
# File 'lib/tomdoc/cli.rb', line 9

def self.options(&block)
  block ? (@options = block) : @options
end

.parse_options(args) ⇒ Object

Actions



113
114
115
# File 'lib/tomdoc/cli.rb', line 113

def self.parse_options(args)
  new.parse_options(args)
end

Instance Method Details

#optionsObject



13
14
15
16
17
# File 'lib/tomdoc/cli.rb', line 13

def options
  OptionParser.new do |opts|
    opts.instance_eval(&self.class.options)
  end
end

#parse_options(args) ⇒ Object



117
118
119
# File 'lib/tomdoc/cli.rb', line 117

def parse_options(args)
  options.parse(args)
end

#pp(*args) ⇒ Object



19
20
21
22
# File 'lib/tomdoc/cli.rb', line 19

def pp(*args)
  require 'pp'
  super
end