summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSanto Cariotti <dcariotti24@gmail.com>2020-03-27 21:03:10 +0100
committerSanto Cariotti <dcariotti24@gmail.com>2020-03-27 21:08:24 +0100
commitf9caa6042d2f90b30417b15aeb0388a96e7a8726 (patch)
treef015f1feac43bf35c8b1fcb127f07a2abd503924 /src
parentc57b5e7d993a58383d471e0080e4a51275cfdcb4 (diff)
fix: split logging colors utils
Diffstat (limited to 'src')
-rw-r--r--src/frest/manage.py8
-rw-r--r--src/frest/manage/bcolors.py17
-rw-r--r--src/frest/manage/utils.py26
3 files changed, 28 insertions, 23 deletions
diff --git a/src/frest/manage.py b/src/frest/manage.py
index 4656f1a..079719e 100644
--- a/src/frest/manage.py
+++ b/src/frest/manage.py
@@ -1,6 +1,6 @@
import argparse
from manage.utils import logo, create_app
-from manage.utils import logging
+from manage.utils import logging, logging_arg
import os
@@ -11,13 +11,11 @@ def main():
if args.startapp:
if not os.path.exists("scheme"):
- logging("Create ")
- logging("scheme/", 0)
- logging("... ")
+ logging_arg("Create {}... ", "scheme/")
logging("OK", 3, "\n")
os.makedirs("scheme")
- create_app(args.startapp.lower())
+ create_app(args.startapp)
if __name__ == "__main__":
diff --git a/src/frest/manage/bcolors.py b/src/frest/manage/bcolors.py
new file mode 100644
index 0000000..eb8b803
--- /dev/null
+++ b/src/frest/manage/bcolors.py
@@ -0,0 +1,17 @@
+class bcolors(object):
+ DARK_GREY = "\033[90m"
+ BOLD = "\033[1m"
+ ERROR = "\033[91m"
+ OK = "\033[92m"
+ WARNING = "\033[93m"
+ ENDC = "\033[0m"
+
+
+COLORS = [
+ bcolors.DARK_GREY,
+ bcolors.BOLD,
+ bcolors.ERROR,
+ bcolors.OK,
+ bcolors.WARNING,
+ bcolors.ENDC,
+]
diff --git a/src/frest/manage/utils.py b/src/frest/manage/utils.py
index 30e3801..5aae18d 100644
--- a/src/frest/manage/utils.py
+++ b/src/frest/manage/utils.py
@@ -1,27 +1,17 @@
-class bcolors(object):
- DARK_GREY = "\033[90m"
- BOLD = "\033[1m"
- ERROR = "\033[91m"
- OK = "\033[92m"
- WARNING = "\033[93m"
- ENDC = "\033[0m"
-
-
-COLORS = [
- bcolors.DARK_GREY,
- bcolors.BOLD,
- bcolors.ERROR,
- bcolors.OK,
- bcolors.WARNING,
- bcolors.ENDC,
-]
-ENDC = len(COLORS) - 1
+import os
+from .bcolors import COLORS
+
+ENDC = len(COLORS) - 1
def logging(text, _type=ENDC, end=""):
print(f"{COLORS[_type]}{text}{COLORS[ENDC]}", end=end)
+def logging_arg(text, *args):
+ args = [f"{COLORS[0]}{i}{COLORS[ENDC]}" for i in args]
+ print(text.format(*args), end="")
+
def logo():
print(
"""