feat: implemented global input output functions
This commit is contained in:
parent
0fedfd880e
commit
430554a570
@ -1 +1,20 @@
|
||||
from .config import config, read_config, write_config
|
||||
from .enums.colors import BColors
|
||||
|
||||
"""
|
||||
Here are all global important functions.
|
||||
"""
|
||||
|
||||
|
||||
def _apply_color(msg: str, color: BColors) -> str:
|
||||
if color is BColors.ENDC:
|
||||
return msg
|
||||
return color.value + msg + BColors.ENDC.value
|
||||
|
||||
|
||||
def output(msg: str, color: BColors = BColors.ENDC):
|
||||
print(_apply_color(msg, color))
|
||||
|
||||
|
||||
def user_input(msg: str, color: BColors = BColors.ENDC):
|
||||
return input(_apply_color(msg, color)).strip()
|
||||
|
@ -1,7 +1,7 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class BColors:
|
||||
class BColors(Enum):
|
||||
# https://stackoverflow.com/a/287944
|
||||
HEADER = "\033[95m"
|
||||
OKBLUE = "\033[94m"
|
||||
|
Loading…
Reference in New Issue
Block a user