require 'optparse' require 'rainbow' require 'reek/cli/report/report' require 'reek/cli/report/formatter' require 'reek/cli/report/strategy' require 'reek/cli/reek_command' require 'reek/cli/help_command' require 'reek/cli/version_command' require 'reek/source' module Reek module Cli # # Parses the command line # class Options def initialize(argv) @argv = argv @parser = OptionParser.new @colored = true @report_class = Report::TextReport @strategy = Report::Strategy::Quiet @warning_formatter = Report::WarningFormatterWithLineNumbers @command_class = ReekCommand @config_files = [] @sort_by_issue_count = false @smells_to_detect = [] set_options end def banner progname = @parser.program_name # SMELL: # The following banner isn't really correct. Help, Version and Reek # are really sub-commands (in the git/svn sense) and so the usage # banner should show three different command-lines. The other # options are all flags for the Reek sub-command. # # reek -h|--help Display a help message # # reek -v|--version Output the tool's version number # # reek [options] files List the smells in the given files # -c|--config file Specify file(s) with config options # -n|--line-number Prefix smelly lines with line numbers # -q|-[no-]quiet Only list files that have smells # files Names of files or dirs to be checked # <