Add cli
This commit is contained in:
@@ -8,7 +8,8 @@ version = "0.0.1"
|
|||||||
description = "Scan tickets and decide"
|
description = "Scan tickets and decide"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pillow==12.1.1"
|
"pillow==12.1.1",
|
||||||
|
"pydantic==2.12.5"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
|
import argparse
|
||||||
|
from pydantic import ValidationError
|
||||||
|
|
||||||
|
from beaky.config import Config
|
||||||
|
from beaky.scanner.scanner import Scanner
|
||||||
|
|
||||||
|
|
||||||
def main():
|
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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
5
src/beaky/config.py
Normal file
5
src/beaky/config.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from pydantic.dataclasses import dataclass
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Config:
|
||||||
|
path: str
|
||||||
Reference in New Issue
Block a user