Skip to content

Commit b1b401d

Browse files
author
Tim Middleton
authored
Fixed an issue where color was not correct on windows (#244)
1 parent dda30ca commit b1b401d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pkg/cmd/formatting_functions.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const stopped = "stopped"
2121

2222
// statusHAFormatter formats a column value and makes it Red if contains ENDANGERED.
2323
var statusHAFormatter = func(s string) string {
24-
if monitorCluster {
24+
if monitorCluster || isWindows() {
2525
return s
2626
}
2727
if strings.Contains(s, endangered) {
@@ -33,7 +33,7 @@ var statusHAFormatter = func(s string) string {
3333

3434
// hitRateFormatter formats a column value which represents a cache hit rate.
3535
var hitRateFormatter = func(s string) string {
36-
if monitorCluster {
36+
if monitorCluster || isWindows() {
3737
return s
3838
}
3939
floatValue, err := strconv.ParseFloat(trimPercent(s), 32)
@@ -52,7 +52,7 @@ var hitRateFormatter = func(s string) string {
5252

5353
// machineMemoryFormatting formats a column value which represents machine percent memory used.
5454
var machineMemoryFormatting = func(s string) string {
55-
if monitorCluster {
55+
if monitorCluster || isWindows() {
5656
return s
5757
}
5858
floatValue, err := strconv.ParseFloat(trimPercent(s), 32)
@@ -71,7 +71,7 @@ var machineMemoryFormatting = func(s string) string {
7171

7272
// errorFormatter formats a column value which represents an error or number that needs to be highlighted.
7373
var errorFormatter = func(s string) string {
74-
if monitorCluster {
74+
if monitorCluster || isWindows() {
7575
return s
7676
}
7777
v, err := getInt64Value(s)
@@ -87,7 +87,7 @@ var errorFormatter = func(s string) string {
8787

8888
// endangeredPartitionsFormatter formats a column value which represents the number of endangered partitions.
8989
var endangeredPartitionsFormatter = func(s string) string {
90-
if monitorCluster {
90+
if monitorCluster || isWindows() {
9191
return s
9292
}
9393
v, err := getInt64Value(s)
@@ -100,7 +100,7 @@ var endangeredPartitionsFormatter = func(s string) string {
100100

101101
// vulnerablePartitionsFormatter formats a column value which represents the number of vulnerable or unbalanced partitions.
102102
var vulnerablePartitionsFormatter = func(s string) string {
103-
if monitorCluster {
103+
if monitorCluster || isWindows() {
104104
return s
105105
}
106106
v, err := getInt64Value(s)
@@ -113,7 +113,7 @@ var vulnerablePartitionsFormatter = func(s string) string {
113113

114114
// packetFormatter formats a column value which represents packages where higher numbers need to be highlighted.
115115
var packetFormatter = func(s string) string {
116-
if monitorCluster {
116+
if monitorCluster || isWindows() {
117117
return s
118118
}
119119
v, err := getInt64Value(s)
@@ -133,7 +133,7 @@ var packetFormatter = func(s string) string {
133133

134134
// healthFormatter formats a column value when false will be displayed in red.
135135
var healthFormatter = func(s string) string {
136-
if monitorCluster {
136+
if monitorCluster || isWindows() {
137137
return s
138138
}
139139
if s == stringFalse {
@@ -144,7 +144,7 @@ var healthFormatter = func(s string) string {
144144

145145
// reporterFormatter formats a column value when "Stopped" will be displayed in red.
146146
var reporterFormatter = func(s string) string {
147-
if monitorCluster {
147+
if monitorCluster || isWindows() {
148148
return s
149149
}
150150
if strings.Contains(strings.ToLower(s), stopped) {
@@ -155,7 +155,7 @@ var reporterFormatter = func(s string) string {
155155

156156
// trueBoolFormatter formats a column value when true will be displayed in red.
157157
var trueBoolFormatter = func(s string) string {
158-
if monitorCluster {
158+
if monitorCluster || isWindows() {
159159
return s
160160
}
161161
if s == stringTrue {
@@ -166,7 +166,7 @@ var trueBoolFormatter = func(s string) string {
166166

167167
// falseBoolFormatter formats a column value when false will be displayed in red.
168168
var falseBoolFormatter = func(s string) string {
169-
if monitorCluster {
169+
if monitorCluster || isWindows() {
170170
return s
171171
}
172172
if s == stringFalse {
@@ -177,7 +177,7 @@ var falseBoolFormatter = func(s string) string {
177177

178178
// yesBoolFormatter formats a column value when yes will be displayed in red.
179179
var yesBoolFormatter = func(s string) string {
180-
if monitorCluster {
180+
if monitorCluster || isWindows() {
181181
return s
182182
}
183183
if strings.Contains(s, "yes") {
@@ -188,7 +188,7 @@ var yesBoolFormatter = func(s string) string {
188188

189189
// healthSummaryFormatter formats a column value for a health summary.
190190
var healthSummaryFormatter = func(s string) string {
191-
if monitorCluster {
191+
if monitorCluster || isWindows() {
192192
return s
193193
}
194194
if !strings.Contains(s, "/") {

0 commit comments

Comments
 (0)