(deps commandDeps)
| 483 | } |
| 484 | |
| 485 | func newTaskUpdateCommand(deps commandDeps) *cobra.Command { |
| 486 | var ( |
| 487 | title string |
| 488 | description string |
| 489 | metadataRaw string |
| 490 | networkRaw string |
| 491 | priorityRaw string |
| 492 | ownerKindRaw string |
| 493 | ownerRef string |
| 494 | clearOwner bool |
| 495 | autoEnqueue bool |
| 496 | ) |
| 497 | |
| 498 | cmd := &cobra.Command{ |
| 499 | Use: taskUpdateIDValue, |
| 500 | Short: "Update mutable task fields", |
| 501 | Args: exactOneNonBlankArg(), |
| 502 | RunE: func(cmd *cobra.Command, args []string) error { |
| 503 | client, err := clientFromDeps(deps) |
| 504 | if err != nil { |
| 505 | return err |
| 506 | } |
| 507 | |
| 508 | request, err := buildTaskUpdateRequest(cmd, taskUpdateInput{ |
| 509 | Title: title, |
| 510 | Description: description, |
| 511 | PriorityRaw: priorityRaw, |
| 512 | MetadataRaw: metadataRaw, |
| 513 | NetworkRaw: networkRaw, |
| 514 | OwnerKindRaw: ownerKindRaw, |
| 515 | OwnerRef: ownerRef, |
| 516 | ClearOwner: clearOwner, |
| 517 | AutoEnqueueOnReady: autoEnqueue, |
| 518 | AutoEnqueueSet: cmd.Flags().Changed(taskAutoEnqueueOnReadyFlag), |
| 519 | }) |
| 520 | if err != nil { |
| 521 | return err |
| 522 | } |
| 523 | if !request.HasChanges() { |
| 524 | return errors.New("cli: task update requires at least one change flag") |
| 525 | } |
| 526 | |
| 527 | updated, err := client.UpdateTask(cmd.Context(), args[0], request) |
| 528 | if err != nil { |
| 529 | return err |
| 530 | } |
| 531 | return writeCommandOutput(cmd, taskBundle(&updated)) |
| 532 | }, |
| 533 | } |
| 534 | cmd.Flags().StringVar(&title, taskTitleKey, "", "Update the task title") |
| 535 | cmd.Flags().StringVar(&description, taskDescriptionKey, "", "Update the task description") |
| 536 | cmd.Flags(). |
| 537 | StringVar(&priorityRaw, "priority", "", "Update the task priority: low, medium, high, or urgent") |
| 538 | cmd.Flags().StringVar(&metadataRaw, "metadata", "", "Update metadata JSON") |
| 539 | cmd.Flags(). |
| 540 | StringVar(&networkRaw, "channel", "", "Update the network channel; pass an empty value to clear it") |
| 541 | cmd.Flags().StringVar(&ownerKindRaw, "owner-kind", "", "Update the owner kind") |
| 542 | cmd.Flags().StringVar(&ownerRef, "owner-ref", "", "Update the owner reference") |
no test coverage detected