This commit is contained in:
2025-11-29 11:51:59 +03:00
parent 47fda23431
commit 2a96dfcabe
28 changed files with 103 additions and 242 deletions
+6 -7
View File
@@ -1,20 +1,19 @@
from argenta import Command
from argenta.command import Flag, Flags
from argenta.command import Flag, Flags, Command
# Простая команда без флагов
# Simple command without flags
hello_cmd = Command("hello", description="Greet the user")
# Команда с описанием и псевдонимами
# Command with description and aliases
quit_cmd = Command("quit", description="Exit the application", aliases=["exit", "q"])
# Команда с флагами
# Command with flags
deploy_cmd = Command(
"deploy",
description="Deploy application to server",
flags=Flags(
[
Flag("env", help="Environment name", possible_values=["dev", "prod"]),
Flag("force", help="Force deployment"),
Flag("env", possible_values=["dev", "prod"]),
Flag("force"),
]
),
aliases=["dep"],
+1 -1
View File
@@ -4,7 +4,7 @@ router = Router(title="User Management")
@router.command(Command("create-user", description="Create a new user account"))
def handle_create_user(response):
def handle_create_user(response: Response):
print("Creating new user...")
+3 -3
View File
@@ -10,9 +10,9 @@ router = Router(title="Server Management")
description="Start the server",
flags=Flags(
[
Flag("port", help="Server port", default="8080"),
Flag("host", help="Server host", default="localhost"),
Flag("debug", help="Enable debug mode"),
Flag("port"),
Flag("host"),
Flag("debug"),
]
),
aliases=["run"],
+11
View File
@@ -0,0 +1,11 @@
from argenta import Router, Command, Response
router = Router(title="System")
@router.command(Command(
"shutdown",
description="Shutdown the system",
aliases=["poweroff", "halt", "stop"]
))
def handle_shutdown(response: Response):
print("Shutting down the system...")