Diff of /aitrika/utils/loader.py [000000] .. [1bdb11]

Switch to unified view

a b/aitrika/utils/loader.py
1
from yaspin import yaspin
2
3
4
def loader(text: str):
5
    """
6
    Custom spinner for terminal.
7
8
    Args:
9
        text (str): Text to display
10
    """
11
12
    def decorator(func):
13
        def wrapper(self, *args, **kwargs):
14
            with yaspin(text=text, color="cyan") as sp:
15
                result = func(self, *args, **kwargs)
16
                sp.ok("✔")
17
                return f"\n{result}"
18
19
        return wrapper
20
21
    return decorator