30 lines
776 B
Python
30 lines
776 B
Python
import sys
|
|
|
|
class Colors:
|
|
RESET = "\033[0m"
|
|
RED = "\033[31m"
|
|
GREEN = "\033[32m"
|
|
YELLOW = "\033[33m"
|
|
BLUE = "\033[34m"
|
|
MAGENTA = "\033[35m"
|
|
CYAN = "\033[36m"
|
|
WHITE = "\033[37m"
|
|
|
|
class BaseCli:
|
|
def __init__(self, debug=False):
|
|
self.debug_enabled=debug
|
|
|
|
def info(self, message):
|
|
print(f'[{Colors.GREEN}INFO{Colors.RESET}] {message}')
|
|
|
|
def warning(self, message):
|
|
print(f'[{Colors.YELLOW}WARNING{Colors.RESET}] {message}')
|
|
|
|
def error(self, message, exit_code=1):
|
|
print(f'[{Colors.RED}ERROR{Colors.RESET}] {message}')
|
|
sys.exit(exit_code)
|
|
|
|
def debug(self, message):
|
|
if not self.debug_enabled:
|
|
return
|
|
print(f'[{Colors.BLUE}DEBUG{Colors.RESET}] {message}') |