| 309 | } |
| 310 | |
| 311 | func shouldUseCustomOutputFormat(opts *WaitOptions, t *tasks.Task) bool { |
| 312 | if opts.Command == nil { |
| 313 | return false |
| 314 | } |
| 315 | |
| 316 | outputFormat, _ := opts.Command.Flags().GetString(constants.FlagOutputFormat) |
| 317 | isFormatSpecified := opts.Command.Flags().Changed(constants.FlagOutputFormat) |
| 318 | isJsonOrTable := outputFormat == constants.OutputFormatJson || outputFormat == constants.OutputFormatTable |
| 319 | isTaskReady := !opts.ShowProgress || (t.IsCompleted != nil && *t.IsCompleted) |
| 320 | |
| 321 | return isFormatSpecified && isJsonOrTable && isTaskReady |
| 322 | } |
| 323 | |
| 324 | func printTaskWithCustomFormat(opts *WaitOptions, t *tasks.Task, tableHeaderPrinted *bool) { |
| 325 | outputFormat, _ := opts.Command.Flags().GetString(constants.FlagOutputFormat) |