Commit b020b8d8 authored by one's avatar one
Browse files

[xcl-lens] Add --version

parent 80b9c37f
......@@ -5,6 +5,7 @@ from typing import Annotated
import typer
from . import __version__
from .runner import run_with_input
from .utils import get_mpi_rank
......@@ -20,6 +21,12 @@ app = typer.Typer(
)
def _version_callback(value: bool):
if value:
typer.echo(f"xcl-lens {__version__}")
raise typer.Exit()
@app.command(
context_settings={
"allow_extra_args": True,
......@@ -29,7 +36,20 @@ app = typer.Typer(
)
def main(
ctx: typer.Context,
summary: Annotated[bool, typer.Option(help="Print summary report only")] = False,
version: Annotated[
bool,
typer.Option(
"--version",
help="Show version and exit",
is_flag=True,
is_eager=True,
callback=_version_callback,
),
] = False,
summary: Annotated[
bool,
typer.Option("-s", "--summary", help="Print summary report only"),
] = False,
verbose: Annotated[bool, typer.Option("-v", "--verbose", help="Print verbose reports")] = False,
hosts: Annotated[str | None, typer.Option(help="Filter by hosts (comma-separated)")] = None,
ranks: Annotated[str | None, typer.Option(help="Filter by ranks (comma-separated)")] = None,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment