github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/cmd/alert/alert.go (about) 1 /* 2 * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved. 3 * This software is released under GPL3. 4 * The full license information can be found under: 5 * https://www.gnu.org/licenses/gpl-3.0.en.html 6 * 7 */ 8 9 package alert 10 11 import ( 12 "github.com/vchain-us/vcn/internal/assert" 13 "github.com/vchain-us/vcn/pkg/cmd/alert/list" 14 15 "github.com/spf13/cobra" 16 ) 17 18 // NewCommand returns the cobra command for `vcn alerts` 19 func NewCommand() *cobra.Command { 20 cmd := &cobra.Command{ 21 Use: "alerts", 22 Aliases: []string{"alert"}, 23 Short: "Manage alerts", 24 Long: ``, 25 Args: cobra.NoArgs, 26 PersistentPreRunE: func(cmd *cobra.Command, args []string) error { 27 cmd.SilenceUsage = true 28 if err := assert.UserLogin(); err != nil { 29 return err 30 } 31 return nil 32 }, 33 } 34 35 cmd.AddCommand(list.NewCommand()) 36 37 return cmd 38 }