Class: Skunk::Cli::Options::Argv

Inherits:
RubyCritic::Cli::Options::Argv
  • Object
show all
Defined in:
lib/skunk/cli/options/argv.rb

Overview

Extends RubyCritic::Cli::Options::Argv to parse a subset of the parameters accepted by RubyCritic

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#output_filenameObject

:reek:Attribute



13
14
15
# File 'lib/skunk/cli/options/argv.rb', line 13

def output_filename
  @output_filename
end

Instance Method Details

#parseObject

rubocop:disable Metrics/MethodLength



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/skunk/cli/options/argv.rb', line 15

def parse # rubocop:disable Metrics/MethodLength
  parser.new do |opts|
    opts.banner = "Usage: skunk [options] [paths]\n"

    opts.on("-b", "--branch BRANCH", "Set branch to compare") do |branch|
      self.base_branch = String(branch)
      set_current_branch
      self.mode = :compare_branches
    end

    opts.on("-o", "--out FILE", "Output report to file") do |filename|
      self.output_filename = filename
    end

    opts.on_tail("-v", "--version", "Show gem's version") do
      self.mode = :version
    end

    opts.on_tail("-h", "--help", "Show this message") do
      self.mode = :help
    end
  end.parse!(@argv)
end

#to_hObject



39
40
41
# File 'lib/skunk/cli/options/argv.rb', line 39

def to_h
  super.merge(output_filename: output_filename)
end