mirror of
https://github.com/onyx-and-iris/vban-cli.git
synced 2026-03-02 21:19:11 +00:00
12 lines
383 B
Python
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
|