feat: colored asking for bool

This commit is contained in:
Hazel 2024-05-27 13:55:18 +02:00
parent 49145a7d93
commit 7219048422
2 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,7 @@ from ..utils.config import main_settings, write_config
from ..utils.enums.colors import BColors from ..utils.enums.colors import BColors
from ..utils.exception import MKInvalidInputException from ..utils.exception import MKInvalidInputException
from ..utils.exception.download import UrlNotFoundException from ..utils.exception.download import UrlNotFoundException
from ..utils.shared import URL_PATTERN from ..utils.shared import HELP_MESSAGE, URL_PATTERN
from ..utils.string_processing import fit_to_file_system from ..utils.string_processing import fit_to_file_system
from ..utils.support_classes.download_result import DownloadResult from ..utils.support_classes.download_result import DownloadResult
from ..utils.support_classes.query import Query from ..utils.support_classes.query import Query
@ -43,6 +43,7 @@ def get_genre():
def help_message(): def help_message():
print(HELP_MESSAGE)
print() print()
print(random.choice(main_settings["happy_messages"])) print(random.choice(main_settings["happy_messages"]))
print() print()

View File

@ -1,3 +1,4 @@
from ..utils import BColors
from ..utils.shared import get_random_message from ..utils.shared import get_random_message
@ -41,6 +42,6 @@ def print_cute_message():
AGREE_INPUTS = {"y", "yes", "ok"} AGREE_INPUTS = {"y", "yes", "ok"}
def ask_for_bool(msg: str) -> bool: def ask_for_bool(msg: str) -> bool:
i = input(msg + " (Y/N):").lower() i = input(f"{msg} ({BColors.OKGREEN.value}Y{BColors.ENDC.value}/{BColors.FAIL.value}N{BColors.ENDC.value})? ").lower()
return i in AGREE_INPUTS return i in AGREE_INPUTS