This commit is contained in:
2025-11-02 01:04:31 +03:00
parent 64c984a704
commit 9c58c10152
70 changed files with 341 additions and 391 deletions
+10 -12
View File
@@ -3,26 +3,24 @@ from argenta.command import Flag, Flags
router = Router(title="Iterate Example")
@router.command(Command(
"process",
description="Process with multiple flags",
flags=Flags([
Flag("file"),
Flag("format"),
Flag("output")
])
))
@router.command(
Command(
"process",
description="Process with multiple flags",
flags=Flags([Flag("file"), Flag("format"), Flag("output")]),
)
)
def process_handler(response: Response):
input_flags = response.input_flags
# Итерируемся по всем введённым флагам
print("All flags:")
for flag in input_flags:
status_str = flag.status.name if flag.status else "None"
print(f" {flag.string_entity}: {flag.input_value} (status: {status_str})")
# Также можно использовать enumerate для получения индексов
print("\nFlags with indices:")
for index, flag in enumerate(input_flags):
print(f" [{index}] {flag.name}: {flag.input_value}")