Skip to content

Commit 4ddfc55

Browse files
committed
fix invalid json/yaml
1 parent 9f314bd commit 4ddfc55

File tree

1 file changed

+5
-7
lines changed
  • internal/cmd/public-ip/ranges/list

1 file changed

+5
-7
lines changed

internal/cmd/public-ip/ranges/list/list.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,9 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
6363
// Call API
6464
req := apiClient.ListPublicIPRanges(ctx)
6565
resp, err := req.Execute()
66-
6766
if err != nil {
6867
return fmt.Errorf("list public IP ranges: %w", err)
6968
}
70-
71-
if resp.Items == nil || len(*resp.Items) == 0 {
72-
params.Printer.Info("No public IP ranges found\n")
73-
return nil
74-
}
75-
7669
publicIpRanges := *resp.Items
7770

7871
// Truncate output
@@ -139,6 +132,11 @@ func outputResult(p *print.Printer, outputFormat string, publicIpRanges []iaas.P
139132

140133
return nil
141134
default:
135+
if len(publicIpRanges) == 0 {
136+
p.Outputln("No public IP ranges found")
137+
return nil
138+
}
139+
142140
for _, item := range publicIpRanges {
143141
if item.Cidr != nil && *item.Cidr != "" {
144142
p.Outputln(*item.Cidr)

0 commit comments

Comments
 (0)