From e3ebc1b17b584b9eb89e3141526679f7360e905e Mon Sep 17 00:00:00 2001 From: Roland Thomas Date: Sun, 1 Jun 2025 23:12:53 -0400 Subject: [PATCH] Fix validation for empty input --- examples/falyx_demo.py | 2 -- falyx/falyx.py | 8 ++++++-- falyx/version.py | 2 +- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/falyx_demo.py b/examples/falyx_demo.py index 757f5a2..4ba791b 100644 --- a/examples/falyx_demo.py +++ b/examples/falyx_demo.py @@ -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__ diff --git a/falyx/falyx.py b/falyx/falyx.py index 585cfd4..6137d2d 100644 --- a/falyx/falyx.py +++ b/falyx/falyx.py @@ -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 diff --git a/falyx/version.py b/falyx/version.py index 3d22c21..1d70f6b 100644 --- a/falyx/version.py +++ b/falyx/version.py @@ -1 +1 @@ -__version__ = "0.1.46" +__version__ = "0.1.47" diff --git a/pyproject.toml b/pyproject.toml index 7a58206..b4e14e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "MIT"