Skip to content
Snippets Groups Projects
Verified Commit d49a1ccf authored by Newbyte's avatar Newbyte :snowflake:
Browse files

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 8647dd3b
parent 351b1731
No related branches found
No related tags found
1 merge request!62mrhlpr.frontend: Fix string representation of ActionType
Pipeline #210697 passed with warnings
......@@ -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}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment