NewCollectionCmd returns a new instance of the 'collection' command.
()
| 35 | |
| 36 | // NewCollectionCmd returns a new instance of the 'collection' command. |
| 37 | func NewCollectionCmd() *cobra.Command { |
| 38 | cmd := &cobra.Command{ |
| 39 | Use: "collection [collection]...", |
| 40 | Short: "Get information about collections", |
| 41 | Long: collectionCmdHelp, |
| 42 | Example: collectionCmdExample, |
| 43 | Args: cobra.MinimumNArgs(1), |
| 44 | |
| 45 | RunE: func(cmd *cobra.Command, args []string) error { |
| 46 | p, err := NewPrinter(cmd) |
| 47 | if err != nil { |
| 48 | return err |
| 49 | } |
| 50 | return p.GetAndPrintObjects( |
| 51 | "collections/%s", |
| 52 | utils.StringReaderFromCmdArgs(args), |
| 53 | nil) |
| 54 | }, |
| 55 | } |
| 56 | |
| 57 | cmd.AddCommand(NewCollectionCreateCmd()) |
| 58 | cmd.AddCommand(NewCollectionRenameCmd()) |
| 59 | cmd.AddCommand(NewCollectionUpdateCmd()) |
| 60 | cmd.AddCommand(NewCollectionDeleteCmd()) |
| 61 | cmd.AddCommand(NewCollectionRemoveItemsCmd()) |
| 62 | |
| 63 | addRelationshipCmds(cmd, "collections", "collection", "[collection]", false) |
| 64 | addThreadsFlag(cmd.Flags()) |
| 65 | addIncludeExcludeFlags(cmd.Flags()) |
| 66 | addIDOnlyFlag(cmd.Flags()) |
| 67 | |
| 68 | return cmd |
| 69 | } |
| 70 | |
| 71 | var createCollectionCmdHelp = `Creates a collection from a list of IOCs. |
| 72 |
no test coverage detected