Skip to content

Commit 789b234

Browse files
author
Enda Phelan
committed
restore bold for non-Windows
1 parent 0c92442 commit 789b234

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

pkg/cmd/kafka/consumergroup/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
strimziadminclient "github.com/redhat-developer/app-services-cli/pkg/api/strimzi-admin/client"
1717
"github.com/redhat-developer/app-services-cli/pkg/cmd/factory"
1818
"github.com/redhat-developer/app-services-cli/pkg/cmd/flag"
19+
"github.com/redhat-developer/app-services-cli/pkg/color"
1920
"github.com/redhat-developer/app-services-cli/pkg/connection"
2021
"github.com/redhat-developer/app-services-cli/pkg/dump"
2122
"github.com/redhat-developer/app-services-cli/pkg/iostreams"
@@ -203,8 +204,7 @@ func printConsumerGroupDetails(w io.Writer, consumerGroupData strimziadminclient
203204
activeMembersCount := cgutil.GetActiveConsumersCount(consumers)
204205
partitionsWithLagCount := cgutil.GetPartitionsWithLag(consumers)
205206

206-
fmt.Fprintln(w, localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.activeMembers"), activeMembersCount, "\t", localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.partitionsWithLag"), partitionsWithLagCount)
207-
fmt.Fprintln(w, "")
207+
fmt.Fprintln(w, color.Bold(localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.activeMembers")), activeMembersCount, "\t", color.Bold(localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.partitionsWithLag")), partitionsWithLagCount)
208208
fmt.Fprintln(w, "")
209209

210210
rows := mapConsumerGroupDescribeToTableFormat(consumers)

pkg/color/color.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
package color
33

44
import (
5+
"fmt"
6+
"runtime"
7+
58
"github.com/fatih/color"
69
)
710

@@ -24,3 +27,13 @@ func Success(format string) string {
2427
func Error(format string) string {
2528
return color.HiRedString(format)
2629
}
30+
31+
// Bold makes a string bold
32+
func Bold(s string) string {
33+
// do not bold the string if the current OS is Windows
34+
// Command Prompt does not support ANSI escape characters
35+
if runtime.GOOS == "windows" {
36+
return s
37+
}
38+
return fmt.Sprintf("\033[1m%v\033[0m", s)
39+
}

0 commit comments

Comments
 (0)