mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
new command info
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)))
|
||||
Reference in New Issue
Block a user