From e1a64661b7795d17117a809465bbe1a2d2b1dbf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A8d=E2=80=99C?= Date: Thu, 19 Dec 2024 13:12:04 +0100 Subject: [PATCH] Feat: CLI to add/rm custom corpora WIP toward issue #8 --- bin/cli.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 bin/cli.py diff --git a/bin/cli.py b/bin/cli.py new file mode 100644 index 0000000..edf4d60 --- /dev/null +++ b/bin/cli.py @@ -0,0 +1,40 @@ +from contextlib import contextmanager +from importlib import metadata +from pathlib import Path +from typing import Iterator, List, Literal, Union + +import click +import chardict as corpus + +@click.group() +def cli() -> None: ... + +@cli.command() +@click.argument("filename") +@click.option("-n", + "--name", + default="", + type=str, + help="Define corpus name", +) +@click.option("-c", + "--encoding", + default="utf-8", + type=str) +def add(filename, name, encoding): + corpus.add(filename, name, encoding) + +@cli.command() +@click.argument("name") +def rm(name): + corpus.rm(name) + + +# @cli.command() +# def version() -> None: +# """Show version number and exit.""" +# click.echo(f"kalamine { metadata.version('kalamine') }") + + +if __name__ == "__main__": + cli() \ No newline at end of file