Пример #1
0
def end_task(args, func):
    """Helper for ending tasks"""
    if len(args) > 1:
        tasks = [int(t, 16) for t in args[1:]]
    else:
        rd.print_all_tasks()
        tasks = [ip.get_task()]
    func(tasks)
Пример #2
0
def comments(args: List[str]) -> None:
    """Render cmments"""
    ### TODO: Move to render function and make pretty
    if len(args) > 1:
        task = int(args[1], 16)
    else:
        rd.print_all_tasks()
        task = ip.get_task()

    for comment in da.notes(task):
        print(f"{comment['posted']}:\n{comment['content']}\n")
Пример #3
0
def update(_) -> None:
    """Update a task interactively"""
    rd.print_all_tasks()
    task_to_update = ip.get_task()
    content = input("content: ")
    if content == "":
        content = None
    due = ip.get_due()
    priority = ip.get_priority()
    labels = ip.get_labels()
    td.update_task([task_to_update], due, content, labels, priority)
Пример #4
0
def view(args, date=None) -> None:
    """List interactively"""
    try:
        if not date:
            date = args[args.index("-d") + 1]
    except ValueError:
        date = None

    try:
        project = args[args.index("-p") + 1]
    except ValueError:
        project = None
    rd.print_all_tasks(project=project, date=date)
Пример #5
0

if __name__ == "__main__":
    ARGS = arg_parser()

    da.API = td.API

    OUTPUT_TABLE: Dict = {}

    TASKS: List[int] = []

    if ARGS.task:
        TASKS = [int(task, 16) for task in ARGS.task]

    if ARGS.command == "interactive":
        interactive.interactive()
    elif ARGS.command == "list":
        rd.print_all_tasks(project=ARGS.project, date=ARGS.date)
    elif ARGS.command == "complete":
        if TASKS:
            td.complete_task(TASKS)
    elif ARGS.command == "delete":
        if TASKS:
            td.delete_task(TASKS)
    elif ARGS.command == "add":
        td.add_task(ARGS.content, ARGS.project, ARGS.date, ARGS.labels,
                    ARGS.priority)
    elif ARGS.command == "update":
        td.update_task(TASKS, ARGS.date, ARGS.content, ARGS.labels,
                       ARGS.priority)