def stop(logfile, time_format):
  "stop tracking for the active project"

  def save_and_output(records):
    records = server.stop(records)
    write(records, logfile, time_format)

    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')

    output(records[-1])

  save_and_output(read(logfile, time_format))
def stop ( logfile , time_format ) : def save_and_output ( records ) : records = server . stop ( records ) write ( records , logfile , time_format ) 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' ) output ( records [ - 1 ] ) save_and_output ( read ( logfile , time_format ) )
stop tracking for the active project