added --version flag to cli
All checks were successful
/ test-build (push) Successful in 37s

This commit is contained in:
Daniel Fichtinger 2025-07-16 01:32:59 -04:00
parent 4cef77e4e0
commit 3dc623f1c7
3 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,4 @@
from importlib.metadata import version as __version__
from pathlib import Path
from typing import Annotated
@ -134,8 +135,23 @@ def serve(
)
def version_callback(value: bool):
if value:
print(f"Zona version: {__version__('zona')}")
raise typer.Exit()
@app.callback()
def main_entry(
version: Annotated[ # pyright: ignore[reportUnusedParameter]
bool | None,
typer.Option(
"--version",
callback=version_callback,
is_eager=True,
help="Print version info and exit.",
),
] = None,
verbosity: Annotated[
str,
typer.Option(