diff --git a/changelog.d/20260312_154519_kolo.is.main_cli.md b/changelog.d/20260312_154519_kolo.is.main_cli.md index 16cdd0b..25b2462 100644 --- a/changelog.d/20260312_154519_kolo.is.main_cli.md +++ b/changelog.d/20260312_154519_kolo.is.main_cli.md @@ -8,6 +8,7 @@ For top level release notes, leave all the headers commented out. ### Added - A cli module that implements the ability to launch applications on Argenta, run application benchmarks on Argenta, create a boilerplate for new projects, and much more. +- A new `info` command has been added to the Argenta CLI, providing a quick overview of the installed package and runtime environment. ### Changed diff --git a/src/argenta/_cli/__main__.py b/src/argenta/_cli/__main__.py index 941fb47..22364d1 100644 --- a/src/argenta/_cli/__main__.py +++ b/src/argenta/_cli/__main__.py @@ -1,6 +1,6 @@ from typer import Typer -from .commands import init_handler, new_handler, routes_handler, run_handler +from .commands import init_handler, new_handler, routes_handler, run_handler, info_handler def main() -> None: @@ -32,6 +32,13 @@ def main() -> None: short_help="Create a new project with boilerplate", epilog="This will create a new directory with the project structure.", )(routes_handler) + + app.command( + name="info", + help="Displays information about the installed Argenta package and environment", + short_help="Show Argenta version and environment info", + epilog="Uses metadata to retrieve the installed package version.", + )(info_handler) app() diff --git a/src/argenta/_cli/commands/__init__.py b/src/argenta/_cli/commands/__init__.py index ba55d9f..28d0b11 100644 --- a/src/argenta/_cli/commands/__init__.py +++ b/src/argenta/_cli/commands/__init__.py @@ -2,3 +2,4 @@ from .run import run_handler as run_handler from .init import init_handler as init_handler from .new import new_handler as new_handler from .routes import routes_handler as routes_handler +from .info import info_handler as info_handler diff --git a/src/argenta/_cli/commands/info.py b/src/argenta/_cli/commands/info.py new file mode 100644 index 0000000..525c6be --- /dev/null +++ b/src/argenta/_cli/commands/info.py @@ -0,0 +1,36 @@ +__all__ = ["info_handler"] + +import sys +import platform +from importlib.metadata import version + +from art import text2art # pyright: ignore[reportUnknownVariableType] +from rich.console import Console +from rich.padding import Padding +from rich.table import Table +from rich import box + + +console = Console() + + +def info_handler() -> None: + table = Table( + box=box.SIMPLE, + show_header=False, + pad_edge=False, + show_edge=False, + expand=False, + ) + + table.add_column(style="bold cyan") + table.add_column(style="white", justify="right") + + table.add_row("Argenta version", f'[bold red]{version("argenta")}[/bold red]') + table.add_row("Python version", sys.version.split()[0]) + table.add_row("Platform", f"{platform.system()} {platform.release()} ({platform.machine()})") + table.add_row("Docs", "https://argenta.readthedocs.io") + + console.print(f"[bold red]{text2art("Argenta", font='tarty1')}[/bold red]") + console.print(Padding(table, pad=(2, 5))) + console.print(Padding("[i]made with ❤ by [b]kolo[/b][/i]", pad=(0, 17)))