From aec5dfcacd0a4bacf3152a03fdca8aa4c5212e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Hlavat=C3=BD?= Date: Sun, 8 Mar 2026 13:27:12 +0100 Subject: [PATCH] Add cli --- pyproject.toml | 3 ++- src/beaky/cli.py | 24 ++++++++++++++++++++++-- src/beaky/config.py | 5 +++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/beaky/config.py diff --git a/pyproject.toml b/pyproject.toml index b9ad38d..b642795 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,8 @@ version = "0.0.1" description = "Scan tickets and decide" requires-python = ">=3.12" dependencies = [ - "pillow==12.1.1" + "pillow==12.1.1", + "pydantic==2.12.5" ] [project.optional-dependencies] diff --git a/src/beaky/cli.py b/src/beaky/cli.py index 869533a..608a747 100644 --- a/src/beaky/cli.py +++ b/src/beaky/cli.py @@ -1,5 +1,25 @@ +import argparse +from pydantic import ValidationError + +from beaky.config import Config +from beaky.scanner.scanner import Scanner + + def main(): - print("Hi") + parser = argparse.ArgumentParser( + prog="beaky" + ) + parser.add_argument("path", help="Path to config file.") + args = parser.parse_args() + + try: + config = Config(**vars(args)) + except ValidationError as e: + print("Bad arguments") + print(e) + return + + Scanner(config) if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/src/beaky/config.py b/src/beaky/config.py new file mode 100644 index 0000000..f0e773b --- /dev/null +++ b/src/beaky/config.py @@ -0,0 +1,5 @@ +from pydantic.dataclasses import dataclass + +@dataclass +class Config: + path: str