From 3a7cb85aee94c5eaa234ca38866faa03c32fc7b9 Mon Sep 17 00:00:00 2001 From: gabriel becker Date: Wed, 30 Nov 2022 17:05:12 +1100 Subject: [PATCH] Create configuration command for user input configuration generation. --- src/ankimaker/cli.py | 3 +++ src/ankimaker/commands/from_csv.py | 4 ++-- src/ankimaker/tasks/basic_csv_to_anki.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ankimaker/cli.py b/src/ankimaker/cli.py index 52b8655..c50f7e5 100644 --- a/src/ankimaker/cli.py +++ b/src/ankimaker/cli.py @@ -4,3 +4,6 @@ from ankimaker.commands import cli def main(): cli(prog_name='ankimaker') + +if __name__ == '__main__': + main() diff --git a/src/ankimaker/commands/from_csv.py b/src/ankimaker/commands/from_csv.py index 8a5c5f4..03d8331 100644 --- a/src/ankimaker/commands/from_csv.py +++ b/src/ankimaker/commands/from_csv.py @@ -5,8 +5,8 @@ from ankimaker.tasks import basic_pandas_to_anki @cli.command('csv') -@click.argument('-i', '--input', 'input_file', type=click.Path(exists=True)) -@click.argument('-o', '--output', 'output_file', type=click.Path(exists=False)) +@click.option('-i', '--input', 'input_file', type=click.Path(exists=True)) +@click.option('-o', '--output', 'output_file', type=click.Path(exists=False)) @click.option('-c', '--conf', 'config_file', default=None, type=click.STRING) @click.option('-n', '--name', 'name', default=None, type=click.STRING) def generate_anki( diff --git a/src/ankimaker/tasks/basic_csv_to_anki.py b/src/ankimaker/tasks/basic_csv_to_anki.py index 25b1836..3183c25 100644 --- a/src/ankimaker/tasks/basic_csv_to_anki.py +++ b/src/ankimaker/tasks/basic_csv_to_anki.py @@ -19,7 +19,8 @@ def create_model(): 'qfmt': '
{{Question}}
', 'afmt': '{{FrontSide}}
{{Answer}}
', }, - ]) + ] + ) return my_model