lib/reek/options.rb in kevinrutherford-reek-1.1.3.8 vs lib/reek/options.rb in kevinrutherford-reek-1.1.3.9

- old
+ new

@@ -3,16 +3,17 @@ module Reek class Options - CTX_SORT = '%c %w (%s)' - SMELL_SORT = '[%s] %c %w' + CTX_SORT = '%m%c %w (%s)' + SMELL_SORT = '%m[%s] %c %w' def self.default_options { - :format => CTX_SORT + :format => CTX_SORT, + :show_all => false } end @@opts = default_options @@ -24,23 +25,21 @@ result = default_options parser = OptionParser.new { |opts| set_options(opts, result) } parser.parse!(args) result end - + def self.set_options(opts, config) opts.banner = <<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_all_options(opts, config) end def self.parse(args) @@opts = parse_args(args) if args.length > 0 @@ -49,14 +48,27 @@ return Source.from_io($stdin, '$stdin') end end private + + def self.set_all_options(opts, config) + set_show_all_option(opts, config) + set_help_option(opts) + set_sort_option(config, opts) + set_version_option(opts) + end def self.set_version_option(opts) opts.on("-v", "--version", "Show version") do puts "#{opts.program_name} #{Reek::VERSION}" exit(0) + end + end + + def self.set_show_all_option(opts, config) + opts.on("-a", "--[no-]show-all", "Show all smells, including those masked by config settings") do |opt| + config[:show_all] = opt end end def self.set_help_option(opts) opts.on("-h", "--help", "Show this message") do