tmc/__main__.py
def list_all(course, single=None):
    """
    Lists all of the exercises in the current course.
    """

    def bs(val):
        return "●" if val else " "

    def bc(val):
        return as_success("✔") if val else as_error("✘")

    def format_line(exercise):
        return "{0} │ {1} │ {2} │ {3} │ {4}".format(exercise.tid,
                                                    bs(exercise.is_selected),
                                                    bc(exercise.is_downloaded),
                                                    bc(exercise.is_completed),
                                                    exercise.menuname())

    print("ID{0}│ S │ D │ C │ Name".format(
        (len(str(course.exercises[0].tid)) - 1) * " "
    ))
    if single:
        print(format_line(single))
        return
    for exercise in course.exercises:
        # ToDo: use a pager
        print(format_line(exercise))
def list_all(course, single=None):
    """
    Lists all of the exercises in the current course.
    """

    def bs(val):
        return "●" if val else " "

    def bc(val):
        return as_success("✔") if val else as_error("✘")

    def format_line(exercise):
        return "{0} │ {1} │ {2} │ {3} │ {4}".format(exercise.tid,
                                                    bs(exercise.is_selected),
                                                    bc(exercise.is_downloaded),
                                                    bc(exercise.is_completed),
                                                    exercise.menuname())

    print("ID{0}│ S │ D │ C │ Name".format(
        (len(str(course.exercises[0].tid)) - 1) * " "
    ))
    if single:
        print(format_line(single))
        return
    for exercise in course.exercises:
        # ToDo: use a pager
        print(format_line(exercise))
Lists all of the exercises in the current course.