github.com/crowdsecurity/crowdsec@v1.6.1/cmd/crowdsec-cli/version.go (about) 1 package main 2 3 import ( 4 "github.com/spf13/cobra" 5 6 "github.com/crowdsecurity/crowdsec/pkg/cwversion" 7 ) 8 9 type cliVersion struct{} 10 11 func NewCLIVersion() *cliVersion { 12 return &cliVersion{} 13 } 14 15 func (cli cliVersion) NewCommand() *cobra.Command { 16 cmd := &cobra.Command{ 17 Use: "version", 18 Short: "Display version", 19 Args: cobra.ExactArgs(0), 20 DisableAutoGenTag: true, 21 Run: func(_ *cobra.Command, _ []string) { 22 cwversion.Show() 23 }, 24 } 25 26 return cmd 27 }