cli skeleton + version command
Initialise Typer app with --version flag and help text.
This commit is contained in:
5
src/veritext/cli/__init__.py
Normal file
5
src/veritext/cli/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"""CLI module: Command-line interface for Veritext."""
|
||||||
|
|
||||||
|
from veritext.cli.main import app
|
||||||
|
|
||||||
|
__all__ = ["app"]
|
||||||
31
src/veritext/cli/main.py
Normal file
31
src/veritext/cli/main.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
"""Veritext CLI entry point."""
|
||||||
|
|
||||||
|
import typer
|
||||||
|
|
||||||
|
import veritext
|
||||||
|
|
||||||
|
app = typer.Typer(
|
||||||
|
name="veritext",
|
||||||
|
help="Semantic text validation framework.",
|
||||||
|
no_args_is_help=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback(invoke_without_command=True)
|
||||||
|
def main(
|
||||||
|
version: bool | None = typer.Option(
|
||||||
|
None,
|
||||||
|
"--version",
|
||||||
|
"-V",
|
||||||
|
help="Show version and exit.",
|
||||||
|
is_eager=True,
|
||||||
|
),
|
||||||
|
) -> None:
|
||||||
|
"""Veritext: Semantic text validation framework for Python."""
|
||||||
|
if version:
|
||||||
|
typer.echo(f"veritext {veritext.__version__}")
|
||||||
|
raise typer.Exit()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app()
|
||||||
Reference in New Issue
Block a user