Example #1
0
    # Initialise TodoList Object
    todo = TodoList()

    # Create TODO item(s)
    if get_cli().command[0] == "create":
        x = getCommandArguments(get_cli().command)
        todo.createTodo(x)

    # List item(s)
    if get_cli().command[0] == "list-all":
        # Handle --substring CLI argument
        if get_cli().substring:
            todo.readListSubstring(get_cli().substring[0])
        # Handle --no-complete CLI argument
        elif get_cli().no_complete:
            todo.readListNotComplete(get_cli().no_complete[0])
        # Handle --complete CLI argument
        elif get_cli().complete:
            todo.readListComplete(get_cli().complete[0])
        else:
            # Handle 'list-all'
            if len(get_cli().command) == 1:
                print("All TODO items below:")
                todo.readListAll()
            # Catch for inputs after list-all
            else:
                print('Do not include argument after "list-all"')

    # Delete all TODOs in todo.json
    if get_cli().command[0] == "delete-all":
        todo.deleteAll()