mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
docs
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
from sqlite3 import Connection
|
||||
|
||||
from argenta import Response, Router
|
||||
from argenta.di import FromDishka
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.command("connect")
|
||||
def connect_handler(response: Response, connection: FromDishka[Connection]):
|
||||
connection.execute("...")
|
||||
|
||||
@@ -4,7 +4,6 @@ from argenta.orchestrator.argparser import ArgSpace
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.command("info")
|
||||
def connect_handler(response: Response, argspace: FromDishka[ArgSpace]):
|
||||
print(argspace.get_by_name("type"))
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
from argenta import App
|
||||
|
||||
|
||||
def custom_print_function(text: str) -> None:
|
||||
"""Простая пользовательская функция вывода с префиксом."""
|
||||
print(f"Префикс: {text}")
|
||||
|
||||
|
||||
app = App(
|
||||
initial_message="My App",
|
||||
override_system_messages=True,
|
||||
print_func=custom_print_function,
|
||||
)
|
||||
@@ -1,10 +1,10 @@
|
||||
from argenta.router import Router
|
||||
from argenta import Response, Router
|
||||
|
||||
# Для этого роутера перехват stdout будет отключен
|
||||
interactive_router = Router(disable_redirect_stdout=True)
|
||||
|
||||
|
||||
@interactive_router.command("ask")
|
||||
def ask_name(response):
|
||||
def ask_name(response: Response):
|
||||
name = input("Как вас зовут? ")
|
||||
print(f"Приятно познакомиться, {name}!")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from argenta.app import App
|
||||
from argenta.app.dividing_line import StaticDividingLine
|
||||
from argenta import App
|
||||
from argenta.app import StaticDividingLine
|
||||
|
||||
# Все роутеры по умолчанию будут использовать статическую линию длиной 50 символов
|
||||
# (если для них не отключен перехват stdout)
|
||||
app = App(dividing_line=StaticDividingLine(length=50))
|
||||
|
||||
Reference in New Issue
Block a user