commit:     0193e1980dda46ee8a6811822f41a3baadb90a50
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Sat Feb  1 04:59:35 2025 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sat Feb  8 22:08:22 2025 +0000
URL:        https://gitweb.gentoo.org/proj/elogv.git/commit/?id=0193e198

elogv: match QA class of logs and give it an appropriate colour

Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>

 elogv | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/elogv b/elogv
index ca0ddf0..3853505 100755
--- a/elogv
+++ b/elogv
@@ -141,7 +141,7 @@ you can use these keys to control the behavior of the 
program:
 """
 )
 
-(normal, selected, einfo, elog, ewarn, eerror) = range(6)
+(normal, selected, einfo, elog, ewarn, eerror, eqawarn) = range(7)
 (PATH, CAT, PN, DATE, CLASS) = range(5)
 
 # Character used to print the class of an elog
@@ -224,6 +224,8 @@ class ElogViewer:
             curses.init_pair(ewarn, curses.COLOR_YELLOW, curses.COLOR_BLACK)
             curses.init_pair(eerror, curses.COLOR_RED, curses.COLOR_BLACK)
             curses.init_pair(elog, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
+            # Normally eqawarn color would be orange/brown but this isnt an 
option in curses.
+            curses.init_pair(eqawarn, curses.COLOR_YELLOW, curses.COLOR_BLACK)
         except curses.error:  # e.g. with "TERM=vt100 elogv" invokation
             pass
 
@@ -555,7 +557,7 @@ class ElogViewer:
         Get the highest elog class in a file
         """
         with self.open(filepath) as f:
-            classes = re.findall("LOG:|INFO:|WARN:|ERROR:", f.read())
+            classes = re.findall("LOG:|INFO:|WARN:|ERROR:|QA:", f.read())
 
         if "ERROR:" in classes:
             return eerror
@@ -563,6 +565,8 @@ class ElogViewer:
             return ewarn
         elif "LOG:" in classes:
             return elog
+        elif "QA:" in classes:
+            return eqawarn
         else:
             return einfo
 
@@ -611,6 +615,8 @@ class ElogViewer:
                     self.log_win.addstr(x[: self.width - 2], 
curses.color_pair(eerror))
                 elif x.startswith("LOG:"):
                     self.log_win.addstr(x[: self.width - 2], 
curses.color_pair(elog))
+                elif x.startswith("QA:"):
+                    self.log_win.addstr(x[: self.width - 2], 
curses.color_pair(eqawarn))
                 else:
                     # Strip embedded color codes
                     x = re.sub(ansi_code, "", x)

Reply via email to