(deps commandDeps)
| 356 | } |
| 357 | |
| 358 | func newTaskCreateCommand(deps commandDeps) *cobra.Command { |
| 359 | var ( |
| 360 | id string |
| 361 | identifier string |
| 362 | scopeRaw string |
| 363 | workspaceRef string |
| 364 | networkRaw string |
| 365 | title string |
| 366 | description string |
| 367 | ownerKindRaw string |
| 368 | ownerRef string |
| 369 | metadataRaw string |
| 370 | priorityRaw string |
| 371 | asAgent bool |
| 372 | autoEnqueue bool |
| 373 | noWakeCreator bool |
| 374 | ) |
| 375 | |
| 376 | cmd := &cobra.Command{ |
| 377 | Use: taskCreateKey, |
| 378 | Short: "Create a task", |
| 379 | Args: cobra.NoArgs, |
| 380 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 381 | client, err := clientFromDeps(deps) |
| 382 | if err != nil { |
| 383 | return err |
| 384 | } |
| 385 | |
| 386 | request, err := buildTaskCreateRequest(cmd, taskCreateInput{ |
| 387 | ID: id, |
| 388 | Identifier: identifier, |
| 389 | ScopeRaw: scopeRaw, |
| 390 | WorkspaceRef: workspaceRef, |
| 391 | NetworkRaw: networkRaw, |
| 392 | Title: title, |
| 393 | Description: description, |
| 394 | PriorityRaw: priorityRaw, |
| 395 | OwnerKindRaw: ownerKindRaw, |
| 396 | OwnerRef: ownerRef, |
| 397 | MetadataRaw: metadataRaw, |
| 398 | AutoEnqueueOnReady: autoEnqueue, |
| 399 | NoWakeCreator: noWakeCreator, |
| 400 | }) |
| 401 | if err != nil { |
| 402 | return err |
| 403 | } |
| 404 | |
| 405 | created, err := createTaskRecord(cmd, deps, client, request, asAgent) |
| 406 | if err != nil { |
| 407 | return err |
| 408 | } |
| 409 | return writeCommandOutput(cmd, taskBundle(&created)) |
| 410 | }, |
| 411 | } |
| 412 | cmd.Flags().StringVar(&id, "id", "", "Explicit task ID") |
| 413 | cmd.Flags().StringVar(&identifier, taskIdentifierKey, "", "Human-friendly task identifier") |
| 414 | cmd.Flags().StringVar(&scopeRaw, taskScopeKey, "", "Task scope: global or workspace") |
| 415 | cmd.Flags(). |
no test coverage detected