/
kolo
/
Argenta
Обзор
Документация
Войти
/
kolo
/
Argenta
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/code_snippets/quickstart/simple_app.py
37 строк
959 B
kolo
feat: impl docs (#4)
04 дек 2025, 21:55
Не верифицирован
04 дек 2025, 21:55
ce7e24b
Код
Авторство
О чём код?
from argenta import App, Command, Orchestrator, Router, Response from argenta.command import Flag # 1. Create app and orchestrator instances app = App( prompt=">> ", initial_message="Simple App", farewell_message="Goodbye!", repeat_command_groups_printing=False ) orchestrator = Orchestrator() # 2. Create router for grouping commands main_router = Router(title="Main commands") # 3. Define command and its handler @main_router.command(Command( "hello", description="Prints greeting message", flags=Flag("name") )) def hello_handler(response: Response): """This handler will be called for 'hello' command.""" name = response.input_flags.get_flag_by_name("name") if name: print(f"Hello, {name.input_value}!") else: print("Hello, world!") # 4. Include router to application app.include_router(main_router) # 5. Start application if __name__ == "__main__": orchestrator.start_polling(app)