Sha256: e3e9d5b90c03b1fc99479f257f58f2344de85fc6c3b88cc0537a99b20e25fd0b

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

require 'stringio'

require 'markdo/command'
require 'markdo/overdue_command'
require 'markdo/star_command'
require 'markdo/today_command'
require 'markdo/tomorrow_command'
require 'markdo/week_command'

module Markdo
  class SummaryCommand < Command
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
markdo-0.1.9 lib/markdo/summary_command.rb
markdo-0.1.8 lib/markdo/summary_command.rb