mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
docs
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from argenta import Router, Command, Response
|
||||
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")
|
||||
])
|
||||
))
|
||||
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}")
|
||||
|
||||
Reference in New Issue
Block a user