def output(r): print "worked on %s" % colored(r[0], attrs=['bold']) print " from %s" % colored( server.date_to_txt(r[1][0], time_format), 'green') print " to now, %s" % colored( server.date_to_txt(r[1][1], time_format), 'green') print " => %s elapsed" % colored( time_elapsed(r[1][0], r[1][1]), 'red')
def status(logfile, time_format): "show current status" try: r = read(logfile, time_format)[-1] if r[1][1]: return summary(logfile, time_format) else: print "working on %s" % colored(r[0], attrs=['bold']) print " since %s" % colored( server.date_to_txt(r[1][0], time_format), 'green') print " to now, %s" % colored( server.date_to_txt(now(), time_format), 'green') print " => %s elapsed" % colored(time_elapsed(r[1][0]), 'red') except IndexError: return cmdapp.help()
def start(project, logfile, time_format): "start tracking for <project>" write(server.start(project, read(logfile, time_format)), logfile, time_format) print "starting work on %s" % colored(project, attrs=['bold']) print " at %s" % colored(server.date_to_txt(now(), time_format), 'green')
def start(project, logfile, time_format): "start tracking for <project>" records = read(logfile, time_format) if records and not records[-1][1][1]: print "error: there is a project already active" return write(server.start(project, records), logfile, time_format) print "starting work on %s" % colored(project, attrs=['bold']) print " at %s" % colored(server.date_to_txt(now(), time_format), 'green')