Install CGC-managed Git hooks in the nearest repository. The installed hooks run `cgc update --quiet` after commits and checkouts. Existing non-CGC hooks are preserved unless --force is used.
(
path: str = typer.Argument(".", help="Path inside the Git repository"),
force: bool = typer.Option(False, "--force", "-f", help="Replace existing non-CGC hook files"),
)
| 850 | |
| 851 | @hook_app.command("install") |
| 852 | def hook_install( |
| 853 | path: str = typer.Argument(".", help="Path inside the Git repository"), |
| 854 | force: bool = typer.Option(False, "--force", "-f", help="Replace existing non-CGC hook files"), |
| 855 | ): |
| 856 | """ |
| 857 | Install CGC-managed Git hooks in the nearest repository. |
| 858 | |
| 859 | The installed hooks run `cgc update <repo> --quiet` after commits and |
| 860 | checkouts. Existing non-CGC hooks are preserved unless --force is used. |
| 861 | """ |
| 862 | try: |
| 863 | status = install_hooks(path, force=force) |
| 864 | except HookError as exc: |
| 865 | console.print(f"[bold red]Hook install failed:[/bold red] {exc}") |
| 866 | raise typer.Exit(code=1) |
| 867 | |
| 868 | console.print(f"[green]✓[/green] Installed CGC hooks in [bold]{status.repo_root}[/bold]") |
| 869 | console.print(f"[dim]Git directory: {status.git_dir}[/dim]") |
| 870 | |
| 871 | |
| 872 | @hook_app.command("uninstall") |
nothing calls this directly
no test coverage detected