Add CLI entry point with version command

This commit is contained in:
2025-02-05 19:21:17 +00:00
parent 66ea201f07
commit 5cb8794db8

View File

@@ -0,0 +1,40 @@
"""Command-line interface for py_dvt_ate."""
from typing import Annotated, Optional
import typer
from py_dvt_ate import __version__
app = typer.Typer(
name="py-dvt-ate",
help="Coupled Physics DVT Simulation Platform",
add_completion=False,
)
def version_callback(value: bool) -> None:
"""Print version and exit."""
if value:
typer.echo(f"py-dvt-ate version {__version__}")
raise typer.Exit()
@app.callback()
def main(
version: Annotated[
Optional[bool],
typer.Option(
"--version",
"-v",
help="Show version and exit.",
callback=version_callback,
is_eager=True,
),
] = None,
) -> None:
"""py-dvt-ate: Coupled Physics DVT Simulation Platform."""
if __name__ == "__main__":
app()