mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
* pkg/cwversion cleanup - add missing newline between version and codename - add more information to "support dump" - write "cscli version" and "crowdsec -version" to stdout, not stderr * fix func test * lint
29 lines
526 B
Go
29 lines
526 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/cwversion"
|
|
)
|
|
|
|
type cliVersion struct{}
|
|
|
|
func NewCLIVersion() *cliVersion {
|
|
return &cliVersion{}
|
|
}
|
|
|
|
func (cliVersion) NewCommand() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "version",
|
|
Short: "Display version",
|
|
Args: cobra.NoArgs,
|
|
DisableAutoGenTag: true,
|
|
Run: func(_ *cobra.Command, _ []string) {
|
|
_, _ = os.Stdout.WriteString(cwversion.FullString())
|
|
},
|
|
}
|
|
|
|
return cmd
|
|
}
|