Skip to content

Commit

Permalink
Merge pull request birdayz#149 from Achillesxu/feature/kaf_node_add_c…
Browse files Browse the repository at this point in the history
…ontroler_info

the output of kaf nodes add controller info
  • Loading branch information
birdayz authored Mar 12, 2021
2 parents e60a1cc + ca1bd31 commit aa3d781
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/cmd/kaf/kaf
/dist
/kaf*
.idea

6 changes: 3 additions & 3 deletions cmd/kaf/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var nodeLsCommand = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
admin := getClusterAdmin()

brokers, _, err := admin.DescribeCluster()
brokers, ctlID, err := admin.DescribeCluster()
if err != nil {
errorExit("Unable to describe cluster: %v\n", err)
}
Expand All @@ -44,11 +44,11 @@ var nodeLsCommand = &cobra.Command{

w := tabwriter.NewWriter(outWriter, tabwriterMinWidth, tabwriterWidth, tabwriterPadding, tabwriterPadChar, tabwriterFlags)
if !noHeaderFlag {
fmt.Fprintf(w, "ID\tADDRESS\t\n")
_, _ = fmt.Fprintf(w, "ID\tADDRESS\tCONTROLLER\t\n")
}

for _, broker := range brokers {
fmt.Fprintf(w, "%v\t%v\t\n", broker.ID(), broker.Addr())
_, _ = fmt.Fprintf(w, "%v\t%v\t%v\t\n", broker.ID(), broker.Addr(), broker.ID() == ctlID)
}

w.Flush()
Expand Down

0 comments on commit aa3d781

Please sign in to comment.