class Tlog::Command::All

Public Instance Methods

description() click to toggle source
# File lib/tlog/command/all.rb, line 8
def description
  "prints out all time logs, the time log in-progress if there is one. Or the currently checked-out time log"
end
execute(input, output) click to toggle source
# File lib/tlog/command/all.rb, line 12
def execute(input, output)
  print_time_entry(output)
end
name() click to toggle source
# File lib/tlog/command/all.rb, line 4
def name 
  "all"
end
options(parser, options) click to toggle source
# File lib/tlog/command/all.rb, line 16
def options(parser, options)
  parser.banner = "usage: tlog active"
end

Private Instance Methods

print_logs(active_logs, output) click to toggle source
print_time_entry(output) click to toggle source
# File lib/tlog/command/all.rb, line 22
def print_time_entry(output)
  storage.in_branch do |wd|
    all_logs = @storage.all_log_dirs
    active_logs = []
    all_logs.each do |log|
      log_name = log.basename.to_s
      active_log = Tlog::Entity::Active_Log.new(log_name)
      active_log.current = true if storage.current_log_name == log_name
      active_log.checked_out = true if storage.checkout_value == log_name
      active_logs.push(active_log)
    end
    output.line_yellow("All Time Logs:")
    print_logs(active_logs, output)
  end
end