-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal_output.py
45 lines (39 loc) · 1.2 KB
/
terminal_output.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class Terminal():
def __init__(self):
self.HEADER = '\033[95m'
self.OKBLUE = '\033[94m'
self.OKGREEN = '\033[92m'
self.WARNING = '\033[93m'
self.FAIL = '\033[91m'
self.ENDC = '\033[0m'
self.BOLD = '\033[1m'
self.UNDERLINE = '\033[4m'
def tprint(self, message, msg_type):
if msg_type == 'warn':
tcolor = bcolors.WARNING
elif msg_type == 'ok':
tcolor = bcolors.OKGREEN
elif msg_type == 'okblue':
tcolor = bcolors.OKBLUE
elif msg_type == 'underline':
tcolor = bcolors.UNDERLINE
elif msg_type == 'fail':
tcolor = bcolors.FAIL
elif msg_type == 'header':
tcolor = bcolors.HEADER
elif msg_type == 'info':
tcolor = bcolors.OKBLUE
elif msg_type == 'debug':
tcolor = bcolors.WARNING
elif msg_type == 'error':
tcolor = bcolors.FAIL
print((tcolor + message + bcolors.ENDC))