vban-cli/src/vban_cli/validation.py
onyx-and-iris d9810ce270 enable rich tracebacks
console, error_console are now app attributes.
2026-03-02 12:55:33 +00:00

12 lines
383 B
Python

import re
from .error import VbanCLIValidationError
def is_valid_time_string(type_, value: str) -> str:
"""Validate if the given string is a valid time format (HH:MM:SS)."""
pattern = r'^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$'
if not re.match(pattern, value):
raise VbanCLIValidationError('Invalid time format. Expected HH:MM:SS.')
return value