From d49a1ccfc30386c925a28cddd100dc300772399e Mon Sep 17 00:00:00 2001
From: Stefan Hansson <newbyte@postmarketos.org>
Date: Thu, 21 Nov 2024 13:08:48 +0100
Subject: [PATCH] mrhlpr.frontend: Fix string representation of ActionType

Previously, the string representation for ActionType would be something
like ActionType.OK instead of [OK ] as intended. This resulted in
commands like `$ mrhlpr status` getting an output like this:

    ActionType.OK Changes allowed
    ActionType.OK Clean worktree
    ActionType.NOK Rebase on master
    ActionType.NOK MR-ID in commit msgs
    ActionType.NOK Commit subjects follow format
       668526 doesn't match any regex
    ActionType.NOK Commits are signed

instead of the intended

    [OK ] Changes allowed
    [OK ] Clean worktree
    [NOK] Rebase on master
    [NOK] MR-ID in commit msgs
    [NOK] Commit subjects follow format
       668526 doesn't match any regex
    [NOK] Commits are signed

Fixes 8647dd3b73a4f91288b44924829220f22e1753be
---
 mrhlpr/frontend.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mrhlpr/frontend.py b/mrhlpr/frontend.py
index 42f4eb3..d6757a8 100644
--- a/mrhlpr/frontend.py
+++ b/mrhlpr/frontend.py
@@ -46,6 +46,9 @@ class ActionType(str, Enum):
             case _:
                 raise ValueError(f"No defined color for action {self}")
 
+    def __str__(self) -> str:
+        return self.value
+
 
 def print_action(msg_type: ActionType, message: str) -> None:
     print(f"{msg_type.color.value}{msg_type} {message}{ColorCode.ENDC.value}")
-- 
GitLab