Coverage for src/rhiza_tools/cli.py: 100%
9 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-07-16 12:49 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-07-16 12:49 +0000
1"""CLI commands for Rhiza Tools.
3This module defines the main Typer application for rhiza-tools. It currently
4registers no subcommands (only the top-level ``--version`` option).
6The CLI can be used either as a standalone tool (`rhiza-tools`) or as a
7subcommand of the rhiza CLI (`rhiza tools`). See the project README for usage
8examples.
9"""
11import typer
13from rhiza_tools import __version__
16def version_callback(value: bool) -> None:
17 """Display the version and exit."""
18 if value:
19 typer.echo(f"rhiza-tools version {__version__}")
20 raise typer.Exit()
23app = typer.Typer(help="Rhiza Tools — CI helper CLI for the Rhiza ecosystem.")
26@app.callback()
27def main(
28 version: bool = typer.Option( # eager option; value is consumed by version_callback, not the body
29 None,
30 "--version",
31 help="Show the version and exit.",
32 callback=version_callback,
33 is_eager=True,
34 ),
35) -> None:
36 """Rhiza Tools — CI helper CLI for the Rhiza ecosystem."""