Fix validation for empty input

This commit is contained in:
Roland Thomas Jr 2025-06-01 23:12:53 -04:00
parent 079bc0ee77
commit e3ebc1b17b
Signed by: roland
GPG Key ID: 7C3C2B085A4C2872
4 changed files with 8 additions and 6 deletions

View File

@ -7,11 +7,9 @@ Licensed under the MIT License. See LICENSE file for details.
import asyncio
import random
from argparse import Namespace
from falyx.action import Action, ActionGroup, ChainedAction
from falyx.falyx import Falyx
from falyx.parsers import FalyxParsers, get_arg_parsers
from falyx.version import __version__

View File

@ -83,8 +83,12 @@ class CommandValidator(Validator):
self.falyx = falyx
self.error_message = error_message
def validate(self, _) -> None:
pass
def validate(self, document) -> None:
if not document.text:
raise ValidationError(
message=self.error_message,
cursor_position=len(document.text),
)
async def validate_async(self, document) -> None:
text = document.text

View File

@ -1 +1 @@
__version__ = "0.1.46"
__version__ = "0.1.47"

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "falyx"
version = "0.1.46"
version = "0.1.47"
description = "Reliable and introspectable async CLI action framework."
authors = ["Roland Thomas Jr <roland@rtj.dev>"]
license = "MIT"