@@ -78,17 +78,13 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7878 if err != nil {
7979 return fmt .Errorf ("list server backup schedules: %w" , err )
8080 }
81- schedules := * resp .Items
82- if len (schedules ) == 0 {
83- params .Printer .Info ("No backup schedules found for server %s\n " , serverLabel )
84- return nil
85- }
81+ schedules := resp .GetItems ()
8682
8783 // Truncate output
8884 if model .Limit != nil && len (schedules ) > int (* model .Limit ) {
8985 schedules = schedules [:* model .Limit ]
9086 }
91- return outputResult (params .Printer , model .OutputFormat , schedules )
87+ return outputResult (params .Printer , model .OutputFormat , serverLabel , schedules )
9288 },
9389 }
9490 configureFlags (cmd )
@@ -132,8 +128,12 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *serverbacku
132128 return req
133129}
134130
135- func outputResult (p * print.Printer , outputFormat string , schedules []serverbackup.BackupSchedule ) error {
131+ func outputResult (p * print.Printer , outputFormat , serverLabel string , schedules []serverbackup.BackupSchedule ) error {
136132 return p .OutputResult (outputFormat , schedules , func () error {
133+ if len (schedules ) == 0 {
134+ p .Outputf ("No backup schedules found for server %s\n " , serverLabel )
135+ return nil
136+ }
137137 table := tables .NewTable ()
138138 table .SetHeader ("SCHEDULE ID" , "SCHEDULE NAME" , "ENABLED" , "RRULE" , "BACKUP NAME" , "BACKUP RETENTION DAYS" , "BACKUP VOLUME IDS" )
139139 for i := range schedules {
0 commit comments