From 8dd549b560ec3b7b1ef0fa7a64f421ad4ab28a93 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 26 Sep 2024 17:09:18 +0200 Subject: Add total count to CLI prompt --- cli-project/flashcard_cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli-project/flashcard_cli.py b/cli-project/flashcard_cli.py index 64a26b2..bb2847f 100644 --- a/cli-project/flashcard_cli.py +++ b/cli-project/flashcard_cli.py @@ -7,8 +7,8 @@ from flashcards import Session, SCHEDULERS def cli(): pass -def displayCard(card, index: int, prompt_mode: str) -> None: - click.echo(click.style(f"{index + 1} ===========================================================", fg="blue")) +def displayCard(card, index: int, count: int, prompt_mode: str) -> None: + click.echo(click.style(f"{index + 1}/{count} ===========================================================", fg="blue")) match prompt_mode: case "front": @@ -38,7 +38,7 @@ def practice(state_file, card_files, scheduler_name, count, prompt): session = Session(scheduler_name, card_files, state_file) for i, card in enumerate(session.practice(count)): - displayCard(card, i, prompt) + displayCard(card, i, count, prompt) @cli.command() @click.argument("state_file", nargs=1, type=click.Path()) @@ -53,7 +53,7 @@ def test(state_file, card_files, scheduler_name, count, prompt): session = Session(scheduler_name, card_files, state_file) for i, (card, correct) in enumerate(session.test(count)): - displayCard(card, i, prompt) + displayCard(card, i, count, prompt) correct(click.confirm(click.style("Correct?", bold=True))) if __name__ == '__main__': -- cgit v1.2.3