Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

cli: Shows message for no meshes #4738

Merged
merged 8 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 4 additions & 1 deletion cmd/cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ func (r *remoteVersion) proxyGetMeshVersion(pod string, namespace string, client
}

func (v *versionCmd) outputPrettyVersionInfo(remoteVerList []*remoteVersionInfo) string {
table := "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n"
table := "No meshes in the cluster\n"
if remoteVerList != nil {
table = "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n"
}
for _, remoteVersionInfo := range remoteVerList {
if remoteVersionInfo != nil && remoteVersionInfo.meshName != "" {
table += fmt.Sprintf(
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestOutputPrettyVersionInfo(t *testing.T) {
{
name: "mesh versions with no remote version info",
remoteVersionInfoList: nil,
expected: "\nMESH NAME\tMESH NAMESPACE\tVERSION\tGIT COMMIT\tBUILD DATE\n",
expected: "No meshes in the cluster\n",
},
}

Expand Down