Skip to content

Commit

Permalink
Add color printer class
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed Feb 9, 2024
1 parent 6cddc4f commit bbe5e53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/jarvis-imports
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ from jarvis_util.util.import_all import *
import pathlib
import os


build_global_import_from_bin('jarvis_util')
if __name__ == '__main__':
build_global_import_from_bin('jarvis_util')
1 change: 1 addition & 0 deletions jarvis_util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from jarvis_util.util.import_all import *
from jarvis_util.util.import_mod import *
from jarvis_util.util.argparse import *
from jarvis_util.util.logging import *
from jarvis_util.serialize.ini_file import *
from jarvis_util.serialize.yaml_file import *
from jarvis_util.serialize.text_file import *
Expand Down
1 change: 1 addition & 0 deletions jarvis_util/util/import_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ def build_global_import_from_bin(pkg_name):
:return:
"""
root_path = str(pathlib.Path(__file__).parent.parent.parent.resolve())
print(root_path)
build_global_import_file(root_path, pkg_name)
14 changes: 14 additions & 0 deletions jarvis_util/util/logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from enum import Enum

class Color(Enum):
GREEN = '\033[92m{}\033[0m'
RED = '\033[{}\033[0m'
CYAN = '\033[96m{}\033[0m'

class ColorPrinter:
@staticmethod
def print(self, msg, color=None):
if color is not None:
print(color.value.format(msg))
else:
print(msg)

0 comments on commit bbe5e53

Please sign in to comment.