mirror of
https://github.com/koloideal/Argenta.git
synced 2026-08-08 17:01:13 +03:00
docs: add CLI documentation section with translations and code snippets; refactor mock/ to examples/, improve CLI module (bug fixes, DX, error handling)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from argenta import App, Orchestrator
|
||||
from argenta.command import Router, Command, Response
|
||||
|
||||
router = Router(title="Example")
|
||||
|
||||
@router.command(Command("hello", description="Say hello"))
|
||||
def hello_handler(response: Response):
|
||||
print("Hello, world!")
|
||||
|
||||
|
||||
def create_app() -> App:
|
||||
app = App()
|
||||
app.include_router(router)
|
||||
return app
|
||||
|
||||
|
||||
def main() -> None:
|
||||
orchestrator = Orchestrator()
|
||||
orchestrator.run_repl(create_app())
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,16 @@
|
||||
from argenta import App, Orchestrator
|
||||
from argenta.command import Router, Command, Response
|
||||
|
||||
router = Router(title="Example")
|
||||
|
||||
@router.command(Command("hello", description="Say hello"))
|
||||
def hello_handler(response: Response):
|
||||
print("Hello, world!")
|
||||
|
||||
app = App()
|
||||
app.include_router(router)
|
||||
|
||||
orchestrator = Orchestrator()
|
||||
|
||||
if __name__ == "__main__":
|
||||
orchestrator.run_repl(app)
|
||||
@@ -0,0 +1,4 @@
|
||||
my_project/
|
||||
├── main.py
|
||||
├── handlers.py
|
||||
└── .gitignore
|
||||
@@ -0,0 +1,11 @@
|
||||
my_project/
|
||||
├── src/
|
||||
│ └── my_project/
|
||||
│ └── application/
|
||||
│ ├── __init__.py
|
||||
│ ├── __main__.py
|
||||
│ ├── routers.py
|
||||
│ └── handlers/
|
||||
│ ├── __init__.py
|
||||
│ └── hello_world_handler.py
|
||||
└── .gitignore
|
||||
Reference in New Issue
Block a user