Module: LOCat

Defined in:
lib/locat.rb,
lib/locat/gitloc.rb,
lib/locat/command.rb,
lib/locat/counter.rb,
lib/locat/matcher.rb,
lib/locat/template.rb

Defined Under Namespace

Classes: Command, Counter, GitLOC, Matcher, Template

Class Method Summary collapse

Class Method Details

.cli(*argv) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/locat/command.rb', line 6

def self.cli(*argv)
  options = {}

  OptionParser.new do |opt|
    opt.on('-o', '--output FILE', 'output file') do |output|
      options[:output] = output
    end
    opt.on('-j', '--json', 'output JSON formmated data') do
      options[:format] = 'json'
    end
    opt.on('-y', '--yaml', 'output YAML formmated data') do
      options[:format] = 'yaml'
    end
    opt.on('-c', '--config NAME', 'matcher configuraton') do |name|
      options[:config] ||= []
      options[:config] << name
    end
    opt.on('-t', '--title TITLE', 'title to put on report') do |title|
      options[:title] = title
    end
    opt.on('-D', '--debug', 'run in debug mode') do
      $DEBUG = true
    end
    opt.on('-h', '--help', 'display this help message') do
      puts opt
      exit 0
    end
  end.parse!(argv)

  options[:files] = argv

  command = Command.new(options)
  command.run
end