Class: Markdo::SummaryCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/markdo/summary_command.rb

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Markdo::Command

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/markdo/summary_command.rb', line 12

def run
  commands = [OverdueCommand, StarCommand, TodayCommand, TomorrowCommand, WeekCommand]

  commands.each do |command|
    out = StringIO.new
    command.new(out, @stderr, @env).run

    title = command.to_s.sub(/^Markdo::/, '').sub(/Command$/, '')
    lines = out.string.split("\n")
    sum =  lines.length

    unless sum.zero?
      @stdout.puts("#{title}: #{sum}")
    end
  end
end