File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ """ Constants in use for the CLI
2
+
3
+ This package contains definitions such as colours or output
4
+ messages that are shared across various CLI endpoints.
5
+ """
6
+
7
+ # Define colors for each severity level (0-9)
8
+ # See: https://rich.readthedocs.io/en/stable/appendix/colors.html
9
+ SEVERITY_COLOURS = [
10
+ "grey" , # 0 - least severe
11
+ "chartreuse1" ,
12
+ "gold1" ,
13
+ "yellow" ,
14
+ "orange1" ,
15
+ "deep_pink1" ,
16
+ "deep_pink2" ,
17
+ "deep_pink3" ,
18
+ "red1" ,
19
+ "red3" , # 9 - most severe
20
+ ]
Original file line number Diff line number Diff line change @@ -59,11 +59,12 @@ class AlarmSummary(
59
59
force_process : OptionalHrefMixin = None
60
60
61
61
def __rich_repr__ (self ):
62
+ from gallagher .cli .const import SEVERITY_COLOURS
62
63
return (
63
64
self .id ,
64
- f"{ self .priority } " ,
65
+ f"[ { SEVERITY_COLOURS [ self . priority ] } ] { self .priority } " ,
65
66
self .time .strftime ('%c' ),
66
- self .type ,
67
+ f"[ { SEVERITY_COLOURS [ self .priority ] } ] { self . type } " ,
67
68
)
68
69
69
70
def __str__ (self ):
You can’t perform that action at this time.
0 commit comments