NewCollectionDeleteCmd returns a command for deleting a collection.
()
| 261 | |
| 262 | // NewCollectionDeleteCmd returns a command for deleting a collection. |
| 263 | func NewCollectionDeleteCmd() *cobra.Command { |
| 264 | return &cobra.Command{ |
| 265 | Use: "delete [collection id]", |
| 266 | Short: "Delete a collection.", |
| 267 | Args: cobra.MinimumNArgs(1), |
| 268 | Long: deleteCollectionCmdHelp, |
| 269 | Example: deleteCollectionExample, |
| 270 | |
| 271 | RunE: func(cmd *cobra.Command, args []string) error { |
| 272 | c, err := NewAPIClient() |
| 273 | if err != nil { |
| 274 | return err |
| 275 | } |
| 276 | url := vt.URL("collections/%s", args[0]) |
| 277 | response, err := c.Delete(url) |
| 278 | if err != nil { |
| 279 | return err |
| 280 | } |
| 281 | if response.Error.Code != "" { |
| 282 | return response.Error |
| 283 | } |
| 284 | return nil |
| 285 | }, |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | func rawFromReader(reader utils.StringReader) string { |
| 290 | var lines []string |
no test coverage detected