2023-06-20 14:40:34 +00:00
|
|
|
from ..utils.shared import get_random_message
|
|
|
|
|
|
|
|
|
|
|
|
def cli_function(function):
|
|
|
|
def wrapper(*args, **kwargs):
|
2023-06-21 12:05:40 +00:00
|
|
|
silent = kwargs.get("no_cli", False)
|
|
|
|
if "no_cli" in kwargs:
|
|
|
|
del kwargs["no_cli"]
|
|
|
|
|
|
|
|
if silent:
|
|
|
|
return function(*args, **kwargs)
|
|
|
|
return
|
|
|
|
|
|
|
|
code = 0
|
|
|
|
|
2023-06-20 14:40:34 +00:00
|
|
|
print_cute_message()
|
|
|
|
print()
|
|
|
|
try:
|
2023-06-21 12:05:40 +00:00
|
|
|
code = function(*args, **kwargs)
|
2023-06-20 14:40:34 +00:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
print("\n\nRaise an issue if I fucked up:\nhttps://github.com/HeIIow2/music-downloader/issues")
|
|
|
|
|
|
|
|
finally:
|
|
|
|
print()
|
|
|
|
print_cute_message()
|
|
|
|
print("See you soon! :3")
|
|
|
|
|
|
|
|
exit()
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
|
|
def print_cute_message():
|
|
|
|
message = get_random_message()
|
|
|
|
try:
|
|
|
|
print(message)
|
|
|
|
except UnicodeEncodeError:
|
|
|
|
message = str(c for c in message if 0 < ord(c) < 127)
|
|
|
|
print(message)
|
|
|
|
|
|
|
|
|
2024-05-27 11:41:24 +00:00
|
|
|
AGREE_INPUTS = {"y", "yes", "ok"}
|
|
|
|
def ask_for_bool(msg: str) -> bool:
|
|
|
|
i = input(msg + " (Y/N):").lower()
|
|
|
|
return i in AGREE_INPUTS
|
2023-06-20 14:40:34 +00:00
|
|
|
|