(deps commandDeps)
| 454 | } |
| 455 | |
| 456 | func newTaskInspectCommand(deps commandDeps) *cobra.Command { |
| 457 | return &cobra.Command{ |
| 458 | Use: "inspect <id>", |
| 459 | Short: "Inspect a task or run with diagnostics", |
| 460 | Args: exactOneNonBlankArg(), |
| 461 | RunE: func(cmd *cobra.Command, args []string) error { |
| 462 | client, err := clientFromDeps(deps) |
| 463 | if err != nil { |
| 464 | return err |
| 465 | } |
| 466 | |
| 467 | id := strings.TrimSpace(args[0]) |
| 468 | var inspect TaskInspectRecord |
| 469 | switch taskInspectTargetForID(id) { |
| 470 | case taskInspectTargetTask: |
| 471 | inspect, err = client.InspectTask(cmd.Context(), id) |
| 472 | case taskInspectTargetRun: |
| 473 | inspect, err = client.InspectRun(cmd.Context(), id) |
| 474 | default: |
| 475 | inspect = taskInspectUnknownIDRecord(id, cliNow(deps.now)) |
| 476 | } |
| 477 | if err != nil { |
| 478 | return err |
| 479 | } |
| 480 | return writeCommandOutput(cmd, taskInspectBundle(&inspect)) |
| 481 | }, |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | func newTaskUpdateCommand(deps commandDeps) *cobra.Command { |
| 486 | var ( |
no test coverage detected