Class: Recheck::Command::Reporters

Inherits:
Object
  • Object
show all
Defined in:
lib/recheck/commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv: []) ⇒ Reporters

Returns a new instance of Reporters.



9
10
11
12
13
14
# File 'lib/recheck/commands.rb', line 9

def initialize(argv: [])
  @options = Optimist.options(argv) do
    banner "recheck list_reporters: load and list reporters"
    opt :location, "Show source location", short: :l, type: :boolean, default: false
  end
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
# File 'lib/recheck/commands.rb', line 16

def run
  puts "Available reporters (add yours to recheck/reporter/):\n"
  Recheck::Reporter::Base.subclasses.each do |reporter_class|
    help = reporter_class.respond_to?(:help) ? reporter_class.help : nil
    help ||= "No help avalable"
    puts "#{reporter_class.name}   #{help}"
    puts %(  #{Object.const_source_location(reporter_class.to_s).join(":")}) if @options[:location]
  end
end