Skip to content

Commit a4adb80

Browse files
committed
adapted printing behavior to align with expected behavior
1 parent cc50e9b commit a4adb80

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/cmd/server/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
141141
}
142142

143143
func outputResult(p *print.Printer, outputFormat, projectLabel string, servers []iaas.Server) error {
144-
if len(servers) == 0 {
145-
p.Info("No servers found for project %q\n", projectLabel)
146-
}
147144
switch outputFormat {
148145
case print.JSONOutputFormat:
149146
details, err := json.MarshalIndent(servers, "", " ")
@@ -167,6 +164,10 @@ func outputResult(p *print.Printer, outputFormat, projectLabel string, servers [
167164

168165
return nil
169166
default:
167+
if len(servers) == 0 {
168+
p.Info("No servers found for project %q\n", projectLabel)
169+
return nil
170+
}
170171
table := tables.NewTable()
171172
table.SetHeader("ID", "Name", "Status", "Machine Type", "Availability Zones", "Nic IPv4", "Public IPs")
172173

0 commit comments

Comments
 (0)