Initial commit: ConfigForge v1.0.0
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.8) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / build-package (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.8) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / build-package (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled
This commit is contained in:
54
configforge/cli.py
Normal file
54
configforge/cli.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
"""Main CLI interface for ConfigForge."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
|
from configforge import __version__
|
||||||
|
from configforge.commands import validate, convert, generate, schema
|
||||||
|
|
||||||
|
|
||||||
|
def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> None:
|
||||||
|
"""Callback to print version and exit."""
|
||||||
|
if not value or ctx.resilient_parsing:
|
||||||
|
return
|
||||||
|
|
||||||
|
click.echo(f"ConfigForge v{__version__}")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
@click.group()
|
||||||
|
@click.option(
|
||||||
|
"--version",
|
||||||
|
is_flag=True,
|
||||||
|
callback=print_version,
|
||||||
|
expose_value=False,
|
||||||
|
help="Show version and exit",
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--verbose",
|
||||||
|
"-v",
|
||||||
|
is_flag=True,
|
||||||
|
default=False,
|
||||||
|
help="Enable verbose output",
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--quiet",
|
||||||
|
"-q",
|
||||||
|
is_flag=True,
|
||||||
|
default=False,
|
||||||
|
help="Suppress all output except errors",
|
||||||
|
)
|
||||||
|
def main(verbose: bool, quiet: bool) -> None:
|
||||||
|
"""ConfigForge - A CLI tool for validating, converting, and generating schemas for configuration files."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
main.add_command(validate, "validate")
|
||||||
|
main.add_command(convert, "convert")
|
||||||
|
main.add_command(generate, "generate")
|
||||||
|
main.add_command(schema, "schema")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user