Skip to content

Commit cf977f6

Browse files
author
João Palet
committed
Make pretty the default output for LB describe commands
1 parent 23f3473 commit cf977f6

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

internal/cmd/load-balancer/describe/describe.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *loadbalance
9797

9898
func outputResult(p *print.Printer, outputFormat string, loadBalancer *loadbalancer.LoadBalancer) error {
9999
switch outputFormat {
100-
case print.PrettyOutputFormat:
101-
return outputResultAsTable(p, loadBalancer)
102-
default:
100+
case print.JSONOutputFormat:
103101
details, err := json.MarshalIndent(loadBalancer, "", " ")
104102
if err != nil {
105103
return fmt.Errorf("marshal load balancer: %w", err)
106104
}
107105
p.Outputln(string(details))
108106

109107
return nil
108+
default:
109+
return outputResultAsTable(p, loadBalancer)
110110
}
111111
}
112112

internal/cmd/load-balancer/observability-credentials/describe/describe.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *loadbalance
9595

9696
func outputResult(p *print.Printer, outputFormat string, credentials *loadbalancer.GetCredentialsResponse) error {
9797
switch outputFormat {
98-
case print.PrettyOutputFormat:
98+
case print.JSONOutputFormat:
99+
details, err := json.MarshalIndent(credentials, "", " ")
100+
if err != nil {
101+
return fmt.Errorf("marshal Load Balancer observability credentials: %w", err)
102+
}
103+
p.Outputln(string(details))
104+
105+
return nil
106+
default:
99107
table := tables.NewTable()
100108
table.AddRow("REFERENCE", *credentials.Credential.CredentialsRef)
101109
table.AddSeparator()
@@ -108,14 +116,6 @@ func outputResult(p *print.Printer, outputFormat string, credentials *loadbalanc
108116
return fmt.Errorf("render table: %w", err)
109117
}
110118

111-
return nil
112-
default:
113-
details, err := json.MarshalIndent(credentials, "", " ")
114-
if err != nil {
115-
return fmt.Errorf("marshal Load Balancer observability credentials: %w", err)
116-
}
117-
p.Outputln(string(details))
118-
119119
return nil
120120
}
121121
}

0 commit comments

Comments
 (0)