Class: Rubocop::Options
- Inherits:
-
Object
- Object
- Rubocop::Options
- Defined in:
- lib/rubocop/options.rb
Overview
This class handles command line options.
Constant Summary collapse
- DEFAULT_FORMATTER =
'progress'
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #parse(args) ⇒ Object
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
10 11 12 |
# File 'lib/rubocop/options.rb', line 10 def initialize @options = {} end |
Instance Method Details
#parse(args) ⇒ Object
14 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/rubocop/options.rb', line 14 def parse(args) (args) (args) OptionParser.new do |opts| opts. = 'Usage: rubocop [options] [file1, file2, ...]' option(opts, '--only COP', 'Run just one cop.') do validate_only_option end option(opts, '-c', '--config FILE', 'Specify configuration file.') (opts, args) option(opts, '-r', '--require FILE', 'Require Ruby file.') do |f| require f end add_boolean_flags(opts) end.parse!(args) [@options, args] end |