(deps commandDeps, flags *spawnCommandFlags)
| 85 | } |
| 86 | |
| 87 | func runSpawnCommand(deps commandDeps, flags *spawnCommandFlags) func(*cobra.Command, []string) error { |
| 88 | return func(cmd *cobra.Command, _ []string) error { |
| 89 | request, err := flags.request() |
| 90 | if err != nil { |
| 91 | return err |
| 92 | } |
| 93 | client, err := clientFromDeps(deps) |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | credentials, err := requireAgentCommandIdentity(cmd.Context(), deps, client, agentActionCLI("spawn")) |
| 98 | if err != nil { |
| 99 | return err |
| 100 | } |
| 101 | record, err := client.AgentSpawn(cmd.Context(), request, credentials) |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | return writeCommandOutput(cmd, agentSpawnBundle(&record)) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | func (flags *spawnCommandFlags) request() (AgentSpawnRequest, error) { |
| 110 | if strings.TrimSpace(flags.agentName) == "" { |
no test coverage detected