( cmd *cobra.Command, deps commandDeps, client DaemonClient, request CreateTaskRequest, asAgent bool, )
| 334 | } |
| 335 | |
| 336 | func createTaskRecord( |
| 337 | cmd *cobra.Command, |
| 338 | deps commandDeps, |
| 339 | client DaemonClient, |
| 340 | request CreateTaskRequest, |
| 341 | asAgent bool, |
| 342 | ) (TaskRecord, error) { |
| 343 | if !asAgent { |
| 344 | return client.CreateTask(cmd.Context(), request) |
| 345 | } |
| 346 | credentials, err := requireAgentCommandIdentity( |
| 347 | cmd.Context(), |
| 348 | deps, |
| 349 | client, |
| 350 | agentActionCLI("task.create"), |
| 351 | ) |
| 352 | if err != nil { |
| 353 | return TaskRecord{}, err |
| 354 | } |
| 355 | return client.CreateTaskAsAgent(cmd.Context(), request, credentials) |
| 356 | } |
| 357 | |
| 358 | func newTaskCreateCommand(deps commandDeps) *cobra.Command { |
| 359 | var ( |
no test coverage detected