Class: Rubocop::Changes::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/changes/options.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/changes/options.rb', line 10

def initialize
  @args = Options.new(
    :simple,
    false,
    nil,
    false,
    ENV.fetch('RUBOCOP_CHANGES_BASE_BRANCH', 'main')
  ) # Defaults
end

Instance Method Details

#parse!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rubocop/changes/options.rb', line 20

def parse!
  OptionParser.new do |opts|
    opts.banner = 'Usage: rubocop-changes [options]'

    parse_formatter!(opts)
    parse_commit!(opts)
    parse_quiet!(opts)
    parse_auto_correct!(opts)
    parse_help!(opts)
    parse_version!(opts)
    parse_base_branch!(opts)
  end.parse!

  args
end