mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
Update documentation
This commit is contained in:
@@ -8,10 +8,7 @@ router = Router(title="Example")
|
||||
Command(
|
||||
"example",
|
||||
description="Example command with flags",
|
||||
flags=Flags([
|
||||
Flag("name"),
|
||||
Flag("age")
|
||||
]),
|
||||
flags=Flags([Flag("name"), Flag("age")]),
|
||||
)
|
||||
)
|
||||
def example_handler(response: Response):
|
||||
|
||||
@@ -8,11 +8,7 @@ router = Router(title="Get Flag Example")
|
||||
Command(
|
||||
"config",
|
||||
description="Configure settings",
|
||||
flags=Flags([
|
||||
Flag("host"),
|
||||
Flag("port"),
|
||||
Flag("debug")
|
||||
]),
|
||||
flags=Flags([Flag("host"), Flag("port"), Flag("debug")]),
|
||||
)
|
||||
)
|
||||
def config_handler(response: Response):
|
||||
|
||||
@@ -5,17 +5,11 @@ from argenta.command import InputFlags
|
||||
flags = InputFlags()
|
||||
|
||||
# Create several flags
|
||||
flag1 = InputFlag(
|
||||
name="option1", prefix="--", input_value="value1", status=ValidationStatus.VALID
|
||||
)
|
||||
flag1 = InputFlag(name="option1", prefix="--", input_value="value1", status=ValidationStatus.VALID)
|
||||
|
||||
flag2 = InputFlag(
|
||||
name="option2", prefix="--", input_value="value2", status=ValidationStatus.VALID
|
||||
)
|
||||
flag2 = InputFlag(name="option2", prefix="--", input_value="value2", status=ValidationStatus.VALID)
|
||||
|
||||
flag3 = InputFlag(
|
||||
name="option3", prefix="---", input_value="value3", status=ValidationStatus.VALID
|
||||
)
|
||||
flag3 = InputFlag(name="option3", prefix="---", input_value="value3", status=ValidationStatus.VALID)
|
||||
|
||||
# Add all flags in one call
|
||||
flags.add_flags([flag1, flag2, flag3])
|
||||
|
||||
@@ -26,12 +26,8 @@ flags3 = InputFlags(
|
||||
)
|
||||
|
||||
print(f"flags1 == flags2: {flags1 == flags2}") # True (same names)
|
||||
print(
|
||||
f"flags1 == flags3: {flags1 == flags3}"
|
||||
) # True (same names, values are not considered)
|
||||
print(f"flags1 == flags3: {flags1 == flags3}") # True (same names, values are not considered)
|
||||
|
||||
# Different collections
|
||||
flags4 = InputFlags(
|
||||
[InputFlag(name="flag3", input_value="value3", status=ValidationStatus.VALID)]
|
||||
)
|
||||
flags4 = InputFlags([InputFlag(name="flag3", input_value="value3", status=ValidationStatus.VALID)])
|
||||
print(f"flags1 == flags4: {flags1 == flags4}") # False (different flags)
|
||||
|
||||
Reference in New Issue
Block a user