Coverage for src / rhiza_tools / cli.py: 100%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-05 10:07 +0000

1"""CLI commands for Rhiza Tools.""" 

2 

3import typer 

4 

5from .commands.bump import bump_command 

6 

7app = typer.Typer(help="Rhiza Tools - Extra utilities for Rhiza.") 

8 

9 

10@app.command() 

11def bump( 

12 version: str | None = typer.Argument(None, help="The version to bump to (e.g., 1.0.1, major, minor, patch, etc)"), 

13 dry_run: bool = typer.Option(False, "--dry-run", help="Print what would happen without doing it."), 

14 commit: bool = typer.Option(False, "--commit", help="Commit the changes to git."), 

15 allow_dirty: bool = typer.Option( 

16 False, "--allow-dirty", help="Allow bumping even if the working directory is dirty." 

17 ), 

18 verbose: bool = typer.Option(False, "--verbose", "-v", help="Show detailed output from bump-my-version."), 

19): 

20 """Bump the version of the project.""" 

21 bump_command(version, dry_run, commit, allow_dirty, verbose) 

22 

23 

24@app.command() 

25def release( 

26 dry_run: bool = typer.Option(False, "--dry-run", help="Print what would happen without doing it."), 

27): 

28 """Create a git tag and push to remote to trigger the release workflow.""" 

29 if dry_run: 

30 typer.echo("Would create and push release tag") 

31 else: 

32 typer.echo("Creating and pushing release tag") 

33 # TODO: Implement actual release logic here (port from release.sh) 

34 

35 

36@app.command(name="update-readme-help") 

37def update_readme_help( 

38 dry_run: bool = typer.Option(False, "--dry-run", help="Print what would happen without doing it."), 

39): 

40 """Update README.md with the current output from `make help`.""" 

41 if dry_run: 

42 typer.echo("Would update README.md with make help output") 

43 else: 

44 typer.echo("Updating README.md with make help output") 

45 # TODO: Implement actual update-readme-help logic here (port from update-readme-help.sh)