(deps commandDeps)
| 227 | } |
| 228 | |
| 229 | func newSessionRemoveCommand(deps commandDeps) *cobra.Command { |
| 230 | return &cobra.Command{ |
| 231 | Use: "remove <id>", |
| 232 | Short: "Remove a session and its persisted history", |
| 233 | Example: ` # Remove a stopped session |
| 234 | agh session remove sess_1234`, |
| 235 | Args: exactOneNonBlankArg(), |
| 236 | RunE: func(cmd *cobra.Command, args []string) error { |
| 237 | client, err := clientFromDeps(deps) |
| 238 | if err != nil { |
| 239 | return err |
| 240 | } |
| 241 | info, err := client.GetSession(cmd.Context(), args[0]) |
| 242 | if err != nil { |
| 243 | return err |
| 244 | } |
| 245 | if err := client.DeleteSession(cmd.Context(), args[0]); err != nil { |
| 246 | return err |
| 247 | } |
| 248 | return writeCommandOutput(cmd, sessionBundle(info, deps.now)) |
| 249 | }, |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | func newSessionStatusCommand(deps commandDeps) *cobra.Command { |
| 254 | return &cobra.Command{ |
no test coverage detected