Skip to content

Commit 523600c

Browse files
authored
Require description when creating collections (#42)
1 parent 80dddce commit 523600c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cmd/collection.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ and creates a collection from them.
6666
If the command receives a single hypen (-) the IoCs will be read from the
6767
standard input.`
6868

69-
var createCollectionExample = ` vt collection create -n [collection_name] www.example.com
70-
vt collection create -n [collection_name] www.example.com 8.8.8.8
71-
cat list_of_iocs | vt collection create -n [collection_name] -`
69+
var createCollectionExample = ` vt collection create -n [collection_name] -d [collection_description] www.example.com
70+
vt collection create -n [collection_name] -d [collection_description] www.example.com 8.8.8.8
71+
cat list_of_iocs | vt collection create -n [collection_name] -d [collection_description] -`
7272

7373
// NewCollectionCreateCmd returns a command for creating a collection.
7474
func NewCollectionCreateCmd() *cobra.Command {
@@ -92,6 +92,7 @@ func NewCollectionCreateCmd() *cobra.Command {
9292

9393
collection := vt.NewObject("collection")
9494
collection.SetString("name", viper.GetString("name"))
95+
collection.SetString("description", viper.GetString("description"))
9596
collection.SetData("raw_items", rawFromReader(reader))
9697

9798
if err := c.PostObject(vt.URL("collections"), collection); err != nil {
@@ -113,7 +114,11 @@ func NewCollectionCreateCmd() *cobra.Command {
113114
cmd.Flags().StringP(
114115
"name", "n", "",
115116
"Collection's name (required)")
117+
cmd.Flags().StringP(
118+
"description", "d", "",
119+
"Collection's description (required)")
116120
_ = cmd.MarkFlagRequired("name")
121+
_ = cmd.MarkFlagRequired("description")
117122
addIncludeExcludeFlags(cmd.Flags())
118123
addIDOnlyFlag(cmd.Flags())
119124

0 commit comments

Comments
 (0)