Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mas-mock/_data_/consumer-groups.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"id": "consumer_group_1",
"groupId": "consumer_group_1",
"consumers": [
{
"groupId": "consumer_group_1",
Expand All @@ -23,7 +23,7 @@
]
},
{
"id": "consumer_group_2",
"groupId": "consumer_group_2",
"consumers": [
{
"groupId": "consumer_group_2",
Expand Down
2 changes: 1 addition & 1 deletion mas-mock/src/handlers/kafka-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ module.exports = {
};

function getConsumerGroup(id) {
return consumerGroups.find(c => c.id === id);
return consumerGroups.find(c => c.groupId === id);
}

function getTopic(name) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/kafka/consumergroup/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
strimziadminclient "github.com/redhat-developer/app-services-cli/pkg/api/strimzi-admin/client"
"github.com/redhat-developer/app-services-cli/pkg/cmd/factory"
"github.com/redhat-developer/app-services-cli/pkg/cmd/flag"
"github.com/redhat-developer/app-services-cli/pkg/color"
"github.com/redhat-developer/app-services-cli/pkg/connection"
"github.com/redhat-developer/app-services-cli/pkg/dump"
"github.com/redhat-developer/app-services-cli/pkg/iostreams"
Expand Down Expand Up @@ -204,7 +203,8 @@ func printConsumerGroupDetails(w io.Writer, consumerGroupData strimziadminclient
activeMembersCount := cgutil.GetActiveConsumersCount(consumers)
partitionsWithLagCount := cgutil.GetPartitionsWithLag(consumers)

fmt.Fprintln(w, color.Bold(localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.activeMembers")), activeMembersCount, "\t", color.Bold(localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.partitionsWithLag")), partitionsWithLagCount)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the bolding of text here because Command Prompt does not support ANSI colors. Powershell does and it worked fine though. Do we need to support both??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Here's how it looks without bold titles. Looks just fine. I originally added bold to differentiate it from the values, but capitalising the title does an equally good job.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you detect somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - if runtime.GOOS != "windows".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant between powershell and cmd...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, no I did not see a simple way..not using Go libraries anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sucks. I guess we need to support both... I'm not sure how well adopted powershell actually is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure either, it seems much better and has the same commands as Unix. Best to support both until we know for sure.

fmt.Fprintln(w, localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.activeMembers"), activeMembersCount, "\t", localizer.MustLocalizeFromID("kafka.consumerGroup.describe.output.partitionsWithLag"), partitionsWithLagCount)
fmt.Fprintln(w, "")
fmt.Fprintln(w, "")

rows := mapConsumerGroupDescribeToTableFormat(consumers)
Expand Down
6 changes: 0 additions & 6 deletions pkg/color/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
package color

import (
"fmt"

"github.com/fatih/color"
)

Expand All @@ -26,7 +24,3 @@ func Success(format string) string {
func Error(format string) string {
return color.HiRedString(format)
}

func Bold(s string) string {
return fmt.Sprintf("\033[1m%v\033[0m", s)
}
5 changes: 3 additions & 2 deletions pkg/iostreams/iostreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"io"
"os"

"github.com/fatih/color"
"github.com/mattn/go-isatty"
)

Expand Down Expand Up @@ -92,8 +93,8 @@ func System() *IOStreams {
io := &IOStreams{
In: os.Stdin,
originalOut: os.Stdout,
Out: os.Stdout,
ErrOut: os.Stderr,
Out: color.Output,
ErrOut: color.Error,
}

// prevent duplicate isTerminal queries now that we know the answer
Expand Down