Skip to content

Commit

Permalink
print when no server type in dc
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Aug 28, 2024
1 parent f91798b commit bfad181
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/cmd/datacenter/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ var DescribeCmd = base.DescribeCmd{

slices.SortFunc(allServerTypeStatus, func(a, b *ServerTypeStatus) int { return int(a.ID - b.ID) })

cmd.Printf("Server Types:\n")
if len(allServerTypeStatus) > 0 {
cmd.Printf("Server Types:\n")
for _, t := range allServerTypeStatus {
cmd.Printf(" - ID: %-8d Name: %-8s Supported: %-8s Available: %s\n",
t.ID,
Expand All @@ -71,6 +71,8 @@ var DescribeCmd = base.DescribeCmd{
strconv.FormatBool(t.Available),
)
}
} else {
cmd.Printf(" No server types\n")
}

return nil
Expand Down
2 changes: 2 additions & 0 deletions internal/cmd/datacenter/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Location:
City:
Latitude: 0.000000
Longitude: 0.000000
Server Types:
No server types
`

assert.NoError(t, err)
Expand Down

0 comments on commit bfad181

Please sign in to comment.