Skip to content

Commit

Permalink
feature: Support YAML output for schedules
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Tang <[email protected]>
  • Loading branch information
Standing-Man committed Nov 27, 2024
1 parent f4c2748 commit 1623f2f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/harbor/root/schedule/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ func ListScheduleCommand() *cobra.Command {
Short: "show all schedule jobs in Harbor",
Run: func(cmd *cobra.Command, args []string) {
schedule, err := api.ListSchedule(opts)

if err != nil {
log.Fatalf("failed to get schedule list: %v", err)
}

FormatFlag := viper.GetString("output-format")
if FormatFlag != "" {
utils.PrintPayloadInJSONFormat(schedule)
return
err = utils.PrintFormat(schedule, FormatFlag)
if err != nil {
log.Error(err)
}
} else {
list.ListSchedule(schedule.Payload)
}

list.ListSchedule(schedule.Payload)
},
}

Expand Down

0 comments on commit 1623f2f

Please sign in to comment.