(deps commandDeps)
| 2554 | } |
| 2555 | |
| 2556 | func newTaskRunCompleteCommand(deps commandDeps) *cobra.Command { |
| 2557 | var resultRaw string |
| 2558 | |
| 2559 | cmd := &cobra.Command{ |
| 2560 | Use: "complete <run-id>", |
| 2561 | Short: "Complete a running task run", |
| 2562 | Args: exactOneNonBlankArg(), |
| 2563 | RunE: func(cmd *cobra.Command, args []string) error { |
| 2564 | client, err := clientFromDeps(deps) |
| 2565 | if err != nil { |
| 2566 | return err |
| 2567 | } |
| 2568 | |
| 2569 | request := CompleteTaskRunRequest{} |
| 2570 | if cmd.Flags().Changed("result") { |
| 2571 | request.Result, err = parseJSONFlag("result", resultRaw) |
| 2572 | if err != nil { |
| 2573 | return err |
| 2574 | } |
| 2575 | } |
| 2576 | |
| 2577 | run, err := client.CompleteTaskRun(cmd.Context(), args[0], request) |
| 2578 | if err != nil { |
| 2579 | return err |
| 2580 | } |
| 2581 | return writeCommandOutput(cmd, taskRunBundle(run)) |
| 2582 | }, |
| 2583 | } |
| 2584 | cmd.Flags().StringVar(&resultRaw, "result", "", "Optional result JSON") |
| 2585 | return cmd |
| 2586 | } |
| 2587 | |
| 2588 | func newTaskRunFailCommand(deps commandDeps) *cobra.Command { |
| 2589 | var ( |
no test coverage detected