예제 #1
0
def summary(logfile, time_format):
  "show a summary of all projects"

  def output(summary):
    width = max([len(p[0]) for p in summary]) + 3
    print '\n'.join([
      "%s%s%s" % (p[0], ' ' * (width - len(p[0])),
        colored(minutes_to_txt(p[1]), 'red')) for p in summary])

  output(server.summarize(read(logfile, time_format, only_elapsed=True)))
예제 #2
0
def parse(logfile, time_format):
  "parses a stream with text formatted as a Timed logfile and shows a summary"

  records = [server.record_from_txt(line, only_elapsed=True,
    time_format=time_format) for line in sys.stdin.readlines()]

  # TODO: make this code better.
  def output(summary):
    width = max([len(p[0]) for p in summary]) + 3
    print '\n'.join([
      "%s%s%s" % (p[0], ' ' * (width - len(p[0])),
        colored(minutes_to_txt(p[1]), 'red')) for p in summary])

  output(server.summarize(records))
예제 #3
0
파일: client.py 프로젝트: omarkhan/timed
def daily(project, logfile, time_format):
  "show daily breakdown for <project>"

  def output(summary):
    print '\n'.join([
      "%s %s" % (p[0], colored(minutes_to_txt(p[1]), 'red')) for p in summary])

  def format(record):
    project, times = record
    start, end = times
    return start.date(), server.minutes_elapsed(start, end)

  records = (format(record) for record in read(logfile, time_format)
             if record[0] == project)
  output(server.summarize(records))
예제 #4
0
def daily(project, logfile, time_format):
    "show daily breakdown for <project>"

    def output(summary):
        print '\n'.join([
            "%s %s" % (p[0], colored(minutes_to_txt(p[1]), 'red'))
            for p in summary
        ])

    def format(record):
        project, times = record
        start, end = times
        return start.date(), server.minutes_elapsed(start, end)

    records = (format(record) for record in read(logfile, time_format)
               if record[0] == project)
    output(server.summarize(records))