@@ -64,16 +64,8 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6464 if err != nil {
6565 return fmt .Errorf ("list quotas: %w" , err )
6666 }
67- response .Quotas = nil
68- if items := response .Quotas ; items == nil {
69- params .Printer .Info ("No quotas found for project %q" , projectLabel )
70- } else {
71- if err := outputResult (params .Printer , model .OutputFormat , items ); err != nil {
72- return fmt .Errorf ("output quotas: %w" , err )
73- }
74- }
7567
76- return nil
68+ return outputResult ( params . Printer , model . OutputFormat , projectLabel , response . Quotas )
7769 },
7870 }
7971
@@ -100,11 +92,12 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
10092 return request
10193}
10294
103- func outputResult (p * print.Printer , outputFormat string , quotas * iaas.QuotaList ) error {
104- if quotas == nil {
105- return fmt .Errorf ("quotas is nil" )
106- }
95+ func outputResult (p * print.Printer , outputFormat , projectLabel string , quotas * iaas.QuotaList ) error {
10796 return p .OutputResult (outputFormat , quotas , func () error {
97+ if quotas == nil {
98+ p .Outputf ("No quotas found for project %q" , projectLabel )
99+ return nil
100+ }
108101 table := tables .NewTable ()
109102 table .SetHeader ("NAME" , "LIMIT" , "CURRENT USAGE" , "PERCENT" )
110103 if val := quotas .BackupGigabytes ; val != nil {
0 commit comments