github.com/mberwanger/updog@v0.0.1/cmd/push.go (about) 1 package cmd 2 3 import ( 4 "time" 5 6 "github.com/apex/log" 7 "github.com/fatih/color" 8 "github.com/spf13/cobra" 9 ) 10 11 type pushCmd struct { 12 cmd *cobra.Command 13 config string 14 timeout time.Duration 15 } 16 17 func newPushCmd() *pushCmd { 18 root := &pushCmd{} 19 // nolint: dupl 20 cmd := &cobra.Command{ 21 Use: "push", 22 Aliases: []string{"p"}, 23 Short: "push monitors to DataDog", 24 SilenceUsage: true, 25 SilenceErrors: true, 26 Args: cobra.NoArgs, 27 RunE: func(cmd *cobra.Command, args []string) error { 28 start := time.Now() 29 30 log.Infof(color.New(color.Bold).Sprint("pushing...")) 31 32 log.Infof(color.New(color.Bold).Sprintf("push succeeded after %0.2fs", time.Since(start).Seconds())) 33 return nil 34 }, 35 } 36 37 cmd.Flags().StringVarP(&root.config, "config", "f", "", "Load configuration from file") 38 cmd.Flags().DurationVar(&root.timeout, "timeout", 30*time.Minute, "Timeout to the entire release process") 39 40 root.cmd = cmd 41 return root 42 }