Update documentation and code snippets

This commit is contained in:
2025-12-02 11:22:31 +03:00
parent 2ff47398ba
commit 7c20bf296b
23 changed files with 63 additions and 62 deletions
+4 -4
View File
@@ -2,19 +2,19 @@ import re
from argenta.command.flag.models import Flag, PossibleValues
# Флаг со списком допустимых значений
# Flag with list of allowed values
format_flag = Flag(name="format", possible_values=["json", "xml", "csv"])
# Валидация значений
# Value validation
print(format_flag.validate_input_flag_value("json")) # True
print(format_flag.validate_input_flag_value("pdf")) # False
# Флаг без значения
# Flag without value
help_flag = Flag(name="help", possible_values=PossibleValues.NEITHER)
print(help_flag.validate_input_flag_value(None)) # True
print(help_flag.validate_input_flag_value("value")) # False
# Флаг с регулярным выражением
# Flag with regular expression
port_flag = Flag(name="port", possible_values=re.compile(r"^\d{1,5}$"))
print(port_flag.validate_input_flag_value("8080")) # True
print(port_flag.validate_input_flag_value("abc")) # False