Fix validation for empty input
This commit is contained in:
parent
079bc0ee77
commit
e3ebc1b17b
|
@ -7,11 +7,9 @@ Licensed under the MIT License. See LICENSE file for details.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import random
|
import random
|
||||||
from argparse import Namespace
|
|
||||||
|
|
||||||
from falyx.action import Action, ActionGroup, ChainedAction
|
from falyx.action import Action, ActionGroup, ChainedAction
|
||||||
from falyx.falyx import Falyx
|
from falyx.falyx import Falyx
|
||||||
from falyx.parsers import FalyxParsers, get_arg_parsers
|
|
||||||
from falyx.version import __version__
|
from falyx.version import __version__
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,12 @@ class CommandValidator(Validator):
|
||||||
self.falyx = falyx
|
self.falyx = falyx
|
||||||
self.error_message = error_message
|
self.error_message = error_message
|
||||||
|
|
||||||
def validate(self, _) -> None:
|
def validate(self, document) -> None:
|
||||||
pass
|
if not document.text:
|
||||||
|
raise ValidationError(
|
||||||
|
message=self.error_message,
|
||||||
|
cursor_position=len(document.text),
|
||||||
|
)
|
||||||
|
|
||||||
async def validate_async(self, document) -> None:
|
async def validate_async(self, document) -> None:
|
||||||
text = document.text
|
text = document.text
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.1.46"
|
__version__ = "0.1.47"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "falyx"
|
name = "falyx"
|
||||||
version = "0.1.46"
|
version = "0.1.47"
|
||||||
description = "Reliable and introspectable async CLI action framework."
|
description = "Reliable and introspectable async CLI action framework."
|
||||||
authors = ["Roland Thomas Jr <roland@rtj.dev>"]
|
authors = ["Roland Thomas Jr <roland@rtj.dev>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
Loading…
Reference in New Issue