def finish(id): with DBConn() as c: c.execute("UPDATE task SET finished = ? WHERE id = ?;", (datetime.datetime.utcnow(), id)) rm_tag(c, "started", id) rm_tag(c, "open", id) add_tag(c, "closed", id) print_tasks(c, [id])
def mod(id, priority=None, tags=None, neg_tags=None): with DBConn() as c: if priority or priority == 0: c.execute("UPDATE task SET priority = ? WHERE id = ?", (priority, id)) for tag in tags or []: add_tag(c, tag, id) for tag in neg_tags or []: rm_tag(c, tag, id)
def stop(id): with DBConn() as c: rm_tag(c, "started", id) print_tasks(c, [id])