(cmd *cobra.Command, input taskCreateInput)
| 2987 | } |
| 2988 | |
| 2989 | func buildTaskCreateRequest(cmd *cobra.Command, input taskCreateInput) (CreateTaskRequest, error) { |
| 2990 | scope, workspace, err := resolveTaskScopeWorkspace(input.ScopeRaw, input.WorkspaceRef, true) |
| 2991 | if err != nil { |
| 2992 | return CreateTaskRequest{}, err |
| 2993 | } |
| 2994 | if err := validateTaskChannelFlag(input.NetworkRaw); err != nil { |
| 2995 | return CreateTaskRequest{}, err |
| 2996 | } |
| 2997 | |
| 2998 | owner, err := parseOptionalTaskOwnership(cmd, input.OwnerKindRaw, input.OwnerRef) |
| 2999 | if err != nil { |
| 3000 | return CreateTaskRequest{}, err |
| 3001 | } |
| 3002 | metadata, err := parseOptionalTaskMetadata(cmd, input.MetadataRaw) |
| 3003 | if err != nil { |
| 3004 | return CreateTaskRequest{}, err |
| 3005 | } |
| 3006 | priority, err := parseOptionalChangedTaskPriority(cmd, input.PriorityRaw) |
| 3007 | if err != nil { |
| 3008 | return CreateTaskRequest{}, err |
| 3009 | } |
| 3010 | |
| 3011 | request := CreateTaskRequest{ |
| 3012 | ID: strings.TrimSpace(input.ID), |
| 3013 | Identifier: strings.TrimSpace(input.Identifier), |
| 3014 | Scope: scope, |
| 3015 | Workspace: workspace, |
| 3016 | NetworkChannel: strings.TrimSpace(input.NetworkRaw), |
| 3017 | Title: strings.TrimSpace(input.Title), |
| 3018 | Description: strings.TrimSpace(input.Description), |
| 3019 | Priority: priority, |
| 3020 | AutoEnqueueOnReady: input.AutoEnqueueOnReady, |
| 3021 | Owner: owner, |
| 3022 | Metadata: metadata, |
| 3023 | } |
| 3024 | if input.NoWakeCreator { |
| 3025 | wakeCreator := false |
| 3026 | request.WakeCreator = &wakeCreator |
| 3027 | } |
| 3028 | if request.Title == "" { |
| 3029 | return CreateTaskRequest{}, errors.New("cli: --title is required") |
| 3030 | } |
| 3031 | return request, nil |
| 3032 | } |
| 3033 | |
| 3034 | func parseOptionalTaskOwnership( |
| 3035 | cmd *cobra.Command, |
no test coverage detected