summaryrefslogtreecommitdiffstats
path: root/cli-project
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-09-26 17:09:18 +0200
committerEddy Pedroni <epedroni@pm.me>2024-09-26 17:09:18 +0200
commit8dd549b560ec3b7b1ef0fa7a64f421ad4ab28a93 (patch)
tree96838b371aedf98188948898b63b35793f42e089 /cli-project
parent7d0a6ad41f8ed1e1dbfca4bfafc1917a2e91ce3c (diff)
Add total count to CLI prompt
Diffstat (limited to 'cli-project')
-rw-r--r--cli-project/flashcard_cli.py8
1 files 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__':