Add CLI modules: main, detect, manifest
This commit is contained in:
60
confsync/cli/main.py
Normal file
60
confsync/cli/main.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
"""Main CLI entry point for ConfSync."""
|
||||||
|
|
||||||
|
import typer
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.panel import Panel
|
||||||
|
|
||||||
|
from confsync import __version__
|
||||||
|
from confsync.cli.detect import detect_cmd
|
||||||
|
from confsync.cli.manifest import manifest_cmd
|
||||||
|
from confsync.cli.validate import validate_cmd
|
||||||
|
from confsync.cli.sync import sync_cmd
|
||||||
|
from confsync.cli.merge import merge_cmd
|
||||||
|
from confsync.cli.history import history_cmd
|
||||||
|
|
||||||
|
app = typer.Typer(
|
||||||
|
name="confsync",
|
||||||
|
help="Intelligent Developer Configuration Sync CLI",
|
||||||
|
add_completion=False,
|
||||||
|
no_args_is_help=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
|
||||||
|
app.add_typer(detect_cmd, name="detect", help="Detect and catalog configuration files")
|
||||||
|
app.add_typer(manifest_cmd, name="manifest", help="Manage configuration manifests")
|
||||||
|
app.add_typer(validate_cmd, name="validate", help="Validate configuration files")
|
||||||
|
app.add_typer(sync_cmd, name="sync", help="Synchronize configurations between machines")
|
||||||
|
app.add_typer(merge_cmd, name="merge", help="Merge configuration files")
|
||||||
|
app.add_typer(history_cmd, name="history", help="View and manage configuration change history")
|
||||||
|
|
||||||
|
|
||||||
|
@app.command("version")
|
||||||
|
def show_version():
|
||||||
|
"""Show the ConfSync version."""
|
||||||
|
console.print(f"[bold]ConfSync[/bold] version {__version__}")
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback(invoke_without_command=True)
|
||||||
|
def main_callback(
|
||||||
|
ctx: typer.Context,
|
||||||
|
verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose output"),
|
||||||
|
):
|
||||||
|
"""Configure global options."""
|
||||||
|
if verbose:
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main entry point."""
|
||||||
|
console.print(Panel.fit(
|
||||||
|
"[bold]ConfSync[/bold] - Intelligent Developer Configuration Sync CLI",
|
||||||
|
style="blue",
|
||||||
|
subtitle=f"Version {__version__}",
|
||||||
|
))
|
||||||
|
app()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user