feat(hooks): add git hooks management CLI

This commit is contained in:
sankalp committed 2025-08-25 14:17:12 +05:45
1 parent b09b5f676e
commit 0036e47968
24 files changed
+1221 -531

No files matched your search

+13 -3
View File
@@ -1,6 +1,7 @@
"""
Main CLI for devtools.
"""
import click
from rich.console import Console
from rich.table import Table
@@ -8,20 +9,24 @@ from .shared.config import Config
from .gitignore.cli import cli as gitignore_cli
from .commitgen.cli import cli as commit_cli
from .licensegen.cli import license as license_cli
from .hooks.cli import cli as hooks_cli
from .changelog.cli import cli as changelog_cli
console = Console()
@click.group()
def cli():
"""DevTools - A collection of developer tools."""
pass
@cli.group()
def config():
"""Manage configuration."""
pass
@config.command()
@click.argument("key")
@click.argument("value")
@@ -31,6 +36,7 @@ def set(key: str, value: str):
config.set(key, value)
console.print(f"[green]Set {key} to {value}")
@config.command()
@click.argument("key", required=False)
def show(key: str = None):
@@ -46,12 +52,13 @@ def show(key: str = None):
table = Table(title="Configuration")
table.add_column("Key", style="cyan")
table.add_column("Value", style="green")
for k, v in config.get_all().items():
table.add_row(k, str(v))
console.print(table)
@config.command()
@click.argument("key")
def delete(key: str):
@@ -63,6 +70,7 @@ def delete(key: str):
else:
console.print(f"[yellow]No value set for {key}")
@config.command()
def clear():
"""Clear all configuration values."""
@@ -71,11 +79,13 @@ def clear():
config.clear()
console.print("[green]Cleared all configuration")
# Add subcommands
cli.add_command(commit_cli, name="commit")
cli.add_command(changelog_cli, name="changelog")
cli.add_command(gitignore_cli, name="gitignore")
cli.add_command(license_cli, name="license")
cli.add_command(hooks_cli, name="hooks")
if __name__ == "__main__":
cli()
cli()