mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
ce7e24b924
The entire public api is covered with documentation in two languages - Russian and English. the library now supports the latest three versions of python - 3.12, 3.13 and 3.14 minor design changes: now, when a Boolean flag is entered, its value is an empty string, not None. tests have been adapted to the supported versions of python, readmi has been redesigned in two languages, German is no longer available.
22 lines
777 B
Python
22 lines
777 B
Python
from argenta import Response, Router
|
|
from argenta.di import FromDishka
|
|
from argenta.orchestrator.argparser import ArgSpace, BooleanArgument, ValueArgument
|
|
|
|
router = Router()
|
|
|
|
|
|
@router.command("get_args")
|
|
def get_args(response: Response, argspace: FromDishka[ArgSpace]):
|
|
# Get all boolean flags
|
|
boolean_flags = argspace.get_by_type(BooleanArgument)
|
|
print(f"Active flags: {[arg.name for arg in boolean_flags if arg.value]}")
|
|
|
|
# Get all value arguments
|
|
value_args = argspace.get_by_type(ValueArgument)
|
|
for arg in value_args:
|
|
print(f"{arg.name} = {arg.value}")
|
|
|
|
# Count arguments of each type
|
|
print(f"Boolean arguments: {len(argspace.get_by_type(BooleanArgument))}")
|
|
print(f"Value arguments: {len(argspace.get_by_type(ValueArgument))}")
|