Change color -> style, Add SelectionOption

This commit is contained in:
2025-05-04 19:35:44 -04:00
parent 91c4d5481f
commit f9cb9ebaef
9 changed files with 64 additions and 37 deletions

View File

@ -1,7 +1,7 @@
# Falyx CLI Framework — (c) 2025 rtj.dev LLC — MIT Licensed
"""hooks.py"""
import time
from typing import Callable
from typing import Any, Callable
from falyx.context import ExecutionContext
from falyx.exceptions import CircuitBreakerOpen
@ -10,11 +10,17 @@ from falyx.utils import logger
class ResultReporter:
def __init__(self, formatter: Callable[[], str] | None = None):
def __init__(self, formatter: Callable[[Any], str] | None = None):
"""
Optional result formatter. If not provided, uses repr(result).
"""
self.formatter = formatter or (lambda r: repr(r))
self.formatter = formatter or (self.default_formatter)
def default_formatter(self, result: Any):
"""
Default formatter for results. Converts the result to a string.
"""
return repr(result)
@property
def __name__(self):