Skip to content

Commit

Permalink
Feat: CLI to add/rm custom corpora
Browse files Browse the repository at this point in the history
WIP toward issue #8
  • Loading branch information
Cèd’C committed Dec 19, 2024
1 parent d8c7112 commit e1a6466
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions bin/cli.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit e1a6466

Please sign in to comment.