(deps commandDeps)
| 2520 | } |
| 2521 | |
| 2522 | func newTaskRunAttachSessionCommand(deps commandDeps) *cobra.Command { |
| 2523 | var sessionID string |
| 2524 | |
| 2525 | cmd := &cobra.Command{ |
| 2526 | Use: "attach-session <run-id>", |
| 2527 | Short: "Attach an existing session to a claimed or starting run", |
| 2528 | Args: exactOneNonBlankArg(), |
| 2529 | RunE: func(cmd *cobra.Command, args []string) error { |
| 2530 | client, err := clientFromDeps(deps) |
| 2531 | if err != nil { |
| 2532 | return err |
| 2533 | } |
| 2534 | if strings.TrimSpace(sessionID) == "" { |
| 2535 | return errors.New("cli: --session is required") |
| 2536 | } |
| 2537 | |
| 2538 | run, err := client.AttachTaskRunSession( |
| 2539 | cmd.Context(), |
| 2540 | args[0], |
| 2541 | AttachTaskRunSessionRequest{ |
| 2542 | SessionID: strings.TrimSpace(sessionID), |
| 2543 | }, |
| 2544 | ) |
| 2545 | if err != nil { |
| 2546 | return err |
| 2547 | } |
| 2548 | return writeCommandOutput(cmd, taskRunBundle(run)) |
| 2549 | }, |
| 2550 | } |
| 2551 | cmd.Flags().StringVar(&sessionID, "session", "", "Existing session ID to attach") |
| 2552 | mustMarkFlagRequired(cmd, "session") |
| 2553 | return cmd |
| 2554 | } |
| 2555 | |
| 2556 | func newTaskRunCompleteCommand(deps commandDeps) *cobra.Command { |
| 2557 | var resultRaw string |
no test coverage detected