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

1"""CLI commands for Rhiza Tools. 

2 

3This module defines the main Typer application for rhiza-tools. It currently 

4registers no subcommands (only the top-level ``--version`` option). 

5 

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""" 

10 

11import typer 

12 

13from rhiza_tools import __version__ 

14 

15 

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() 

21 

22 

23app = typer.Typer(help="Rhiza Tools — CI helper CLI for the Rhiza ecosystem.") 

24 

25 

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."""