Skip to content

Commit

Permalink
fix: convert args to str in ui.error, ui.warning,
Browse files Browse the repository at this point in the history
new function: ui.ask_non_empty(msg)
  • Loading branch information
Nayjest committed Nov 19, 2024
1 parent e28a76f commit 35106fb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions microcore/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def debug(msg):


def error(*args, **kwargs):
print(*[Fore.RED + i for i in args], **kwargs)
print(*[Fore.RED + str(i) for i in args], **kwargs)


def warning(*args, **kwargs):
print(*[Fore.YELLOW + i for i in args], **kwargs)
print(*[Fore.YELLOW + str(i) for i in args], **kwargs)


def ask_yn(msg, default=False):
Expand Down Expand Up @@ -55,6 +55,16 @@ def ask_choose(msg, variants: list):
return item


def ask_non_empty(msg):
while True:
i = input(msg)
if i.strip():
break
else:
error("Empty input")
return i


def magenta(msg):
return f"{Fore.MAGENTA}{msg}{Fore.RESET}"

Expand Down

0 comments on commit 35106fb

Please sign in to comment.