mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-17 06:44:23 +01:00
Merge pull request #172 from codingo/colorclass-removal
Colorclass removal
This commit is contained in:
@@ -1 +1 @@
|
|||||||
__version__ = '1.9.6'
|
__version__ = '1.9.7'
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from time import localtime, strftime
|
from time import localtime, strftime
|
||||||
|
|
||||||
from colorclass import Color
|
|
||||||
from colorclass import disable_all_colors
|
|
||||||
|
|
||||||
from Interlace.lib.core.__version__ import __version__
|
from Interlace.lib.core.__version__ import __version__
|
||||||
|
|
||||||
|
|
||||||
|
class bcolors:
|
||||||
|
# credit to: https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal
|
||||||
|
HEADER = '\033[95m'
|
||||||
|
OKBLUE = '\033[94m'
|
||||||
|
OKCYAN = '\033[96m'
|
||||||
|
OKGREEN = '\033[92m'
|
||||||
|
WARNING = '\033[93m'
|
||||||
|
FAIL = '\033[91m'
|
||||||
|
ENDC = '\033[0m'
|
||||||
|
BOLD = '\033[1m'
|
||||||
|
UNDERLINE = '\033[4m'
|
||||||
|
|
||||||
|
|
||||||
class OutputHelper(object):
|
class OutputHelper(object):
|
||||||
def __init__(self, arguments):
|
def __init__(self, arguments):
|
||||||
if arguments.nocolor:
|
self._no_color = arguments.nocolor
|
||||||
disable_all_colors()
|
|
||||||
|
|
||||||
self.verbose = arguments.verbose
|
self.verbose = arguments.verbose
|
||||||
self.silent = arguments.silent
|
self.silent = arguments.silent
|
||||||
self.seperator = "====================================================="
|
self.seperator = "====================================================="
|
||||||
@@ -29,10 +37,17 @@ class OutputHelper(object):
|
|||||||
if level == 0 and not self.verbose:
|
if level == 0 and not self.verbose:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not self._no_color:
|
||||||
formatting = {
|
formatting = {
|
||||||
0: Color('{autoblue}[VERBOSE]{/autoblue}'),
|
0: f'{bcolors.OKBLUE}[VERBOSE]{bcolors.ENDC}',
|
||||||
1: Color('{autogreen}[THREAD]{/autogreen}'),
|
1: f'{bcolors.OKGREEN}[THREAD]{bcolors.ENDC}',
|
||||||
3: Color('{autobgyellow}{autored}[ERROR]{/autored}{/autobgyellow}')
|
3: f'{bcolors.FAIL}[ERROR]{bcolors.ENDC}'
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
formatting = {
|
||||||
|
0: '[VERBOSE]',
|
||||||
|
1: '[THREAD]',
|
||||||
|
3: '[ERROR]'
|
||||||
}
|
}
|
||||||
|
|
||||||
leader = formatting.get(level, '[#]')
|
leader = formatting.get(level, '[#]')
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
colorclass==2.2.2
|
|
||||||
netaddr==0.7.20
|
netaddr==0.7.20
|
||||||
tqdm==4.62.3
|
tqdm==4.62.3
|
||||||
|
|||||||
Reference in New Issue
Block a user