diff options
Diffstat (limited to 'src/flashcard_cli.py')
-rw-r--r-- | src/flashcard_cli.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/flashcard_cli.py b/src/flashcard_cli.py new file mode 100644 index 0000000..9e9633d --- /dev/null +++ b/src/flashcard_cli.py @@ -0,0 +1,33 @@ +import click +from json import load +from os.path import isfile + +from card import Card +from scheduler import getSchedulerClass, SCHEDULERS +from parser import parseFiles + + +@click.group() +def cli(): + pass + +@cli.command() +@click.option("--scheduler", "scheduler_name", default="brutal", type=click.Choice(SCHEDULERS, case_sensitive=False)) +@click.argument("state_file", nargs=1, type=click.Path()) +@click.argument("card_files", nargs=-1, type=click.Path(exists=True)) +def practice(scheduler_name, state_file, card_files): + """ + Run a practice session with the specified scheduler, using the provided state and card files. + """ + cards = parseFiles(card_files) + state = json.load(state_file) if isfile(state_file) else {} + + scheduler = getSchedulerClass(scheduler_name)(cards, state) + + + + + +if __name__ == '__main__': + cli() + |