Skip to content

Commit f180a6f

Browse files
committed
Output result in table to std out
1 parent d6a823c commit f180a6f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/cmd/clients.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ oc plugin mobile get client <clientID>`,
8787
return nil
8888
},
8989
}
90-
90+
cc.Out.AddRenderer(command.Name(), "table", func(out io.Writer, mobileClient interface{}) error {
91+
mClient := mobileClient.(*v1alpha1.MobileClient)
92+
var data [][]string
93+
data = append(data, []string{mClient.Name, mClient.Namespace, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.ApiKey})
94+
table := tablewriter.NewWriter(out)
95+
table.AppendBulk(data)
96+
table.SetHeader([]string{"ID", "Namespace", "Name", "ClientType", "ApiKey"})
97+
table.Render()
98+
return nil
99+
})
91100
return command
92101
}
93102

0 commit comments

Comments
 (0)