-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp_log.py
executable file
·51 lines (42 loc) · 1.45 KB
/
wp_log.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
46
47
48
49
50
51
from colorama import Fore, Style
import sys
from wp_config import CONFIG
def print_e(string, condition=True):
if condition:
if CONFIG['wp_hub']['color_output']:
print(Fore.RED + string + Fore.RESET, file=sys.stderr)
else:
print(string, file=sys.stderr)
#Internal error, something is bad directly in the code,
#use it like stronger error
def print_ie (internal_err_msg):
if CONFIG['wp_hub']['color_output']:
print(Fore.RED + internal_err_msg + Fore.RESET, file=sys.stderr)
else:
print(internal_err_msg, file=sys.stderr)
#Debug print
def print_d(msg):
print(Fore.GREEN + msg + Fore.RESET, file=sys.stderr)
#Print ok message
def print_ok(msg):
if CONFIG['wp_hub']['color_output']:
print(Fore.CYAN + Style.BRIGHT + msg + Style.RESET_ALL, file=sys.stderr)
else:
print(msg)
# Print input question
def input_cyan(prompt):
if CONFIG['wp_hub']['color_output']:
return input(Fore.CYAN + prompt + Fore.RESET).strip()
else:
return input(prompt).strip()
#Someshing is very good (BINGO!)
def print_s(msg):
print(Fore.YELLOW + Style.BRIGHT + msg + Style.RESET_ALL, file=sys.stderr)
def print_saved(msg):
print(f"{Fore.GREEN} [︾] Saved {msg}{Fore.RESET}")
# Warning message
def print_ow(msg):
print(f"{Fore.RED} [✐] Overwriting {msg} {Fore.RESET}")
# Finished message
def print_finished(msg):
print(f"{Fore.CYAN} [✔] Finished {msg} {Fore.RESET}")