Class: Reek::Options
Constant Summary collapse
- CTX_SORT =
'%c %w (%s)'
- SMELL_SORT =
'[%s] %c %w'
- @@opts =
Class Method Summary collapse
- .[](key) ⇒ Object
- .default_options ⇒ Object
- .parse(args) ⇒ Object
- .parse_args(args) ⇒ Object
- .set_options(opts, config) ⇒ Object
Class Method Details
.[](key) ⇒ Object
19 20 21 |
# File 'lib/reek/options.rb', line 19 def self.[](key) @@opts[key] end |
.default_options ⇒ Object
11 12 13 14 15 |
# File 'lib/reek/options.rb', line 11 def self. { :format => CTX_SORT } end |
.parse(args) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/reek/options.rb', line 45 def self.parse(args) begin @@opts = parse_args(args) if args.length > 0 return Source.from_pathlist(args) else return Source.from_io($stdin, 'stdin') end rescue OptionParser::ParseError, SystemCallError => err fatal_error(err) end end |
.parse_args(args) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/reek/options.rb', line 23 def self.parse_args(args) result = parser = OptionParser.new { |opts| (opts, result) } parser.parse!(args) result end |
.set_options(opts, config) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/reek/options.rb', line 30 def self.(opts, config) opts. = <<EOB Usage: #{opts.program_name} [options] files... If no files are given, Reek reads source code from standard input. See http://wiki.github.com/kevinrutherford/reek for detailed help. EOB opts.separator "\nOptions:" set_help_option(opts) set_sort_option(config, opts) set_version_option(opts) set_output_format_option(config, opts) end |