mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
docs
This commit is contained in:
@@ -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"],
|
||||
|
||||
@@ -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...")
|
||||
|
||||
|
||||
|
||||
@@ -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"],
|
||||
|
||||
@@ -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...")
|
||||
Reference in New Issue
Block a user