Parses the command line
# File lib/reek/cli/command_line.rb, line 99 def get_sources if @argv.empty? return [$stdin.to_reek_source('$stdin')] else return Source::SourceLocator.new(@argv).all_sources end end
# File lib/reek/cli/command_line.rb, line 84 def parse @parser.parse!(@argv) if @command_class == HelpCommand HelpCommand.new(@parser) elsif @command_class == VersionCommand VersionCommand.new(@parser.program_name) elsif @command_class == YamlCommand sources = get_sources YamlCommand.create(sources, @config_files) else sources = get_sources ReekCommand.create(sources, @report_class, @config_files) end end
# File lib/reek/cli/command_line.rb, line 57 def set_options @parser.banner = banner @parser.separator "Common options:" @parser.on("-h", "--help", "Show this message") do @command_class = HelpCommand end @parser.on("-v", "--version", "Show version") do @command_class = VersionCommand end @parser.separator "\nConfiguration:" @parser.on("-c", "--config FILE", "Read configuration options from FILE") do |file| @config_files << file end @parser.separator "\nReport formatting:" @parser.on("-q", "--[no-]quiet", "Suppress headings for smell-free source files") do |opt| @report_class = opt ? QuietReport : VerboseReport end @parser.on("-y", "--yaml", "Report smells in YAML format") do @command_class = YamlCommand # SMELL: the args passed to the command should be tested, because it may # turn out that they are passed too soon, ie. before the files have been # separated out from the options end end
Generated with the Darkfish Rdoc Generator 2.