(deps commandDeps)
| 202 | } |
| 203 | |
| 204 | func newSessionStopCommand(deps commandDeps) *cobra.Command { |
| 205 | return &cobra.Command{ |
| 206 | Use: "stop <id>", |
| 207 | Short: "Stop a session", |
| 208 | Example: ` # Stop a running session |
| 209 | agh session stop sess_1234`, |
| 210 | Args: exactOneNonBlankArg(), |
| 211 | RunE: func(cmd *cobra.Command, args []string) error { |
| 212 | client, err := clientFromDeps(deps) |
| 213 | if err != nil { |
| 214 | return err |
| 215 | } |
| 216 | if err := client.StopSession(cmd.Context(), args[0]); err != nil { |
| 217 | return err |
| 218 | } |
| 219 | |
| 220 | info, err := client.GetSession(cmd.Context(), args[0]) |
| 221 | if err != nil { |
| 222 | return err |
| 223 | } |
| 224 | return writeCommandOutput(cmd, sessionBundle(info, deps.now)) |
| 225 | }, |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | func newSessionRemoveCommand(deps commandDeps) *cobra.Command { |
| 230 | return &cobra.Command{ |
no test coverage detected