mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 04:15:54 +02:00
* cscsli: remove unused Command.Args setting * cscli: review/update argument number checking cscli will consistently print the help text if the number of arguments is wrong for the command, but not for other types of errors. * fix func tests * lint
30 lines
584 B
Go
30 lines
584 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/args"
|
|
"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: args.NoArgs,
|
|
DisableAutoGenTag: true,
|
|
Run: func(_ *cobra.Command, _ []string) {
|
|
_, _ = os.Stdout.WriteString(cwversion.FullString())
|
|
},
|
|
}
|
|
|
|
return cmd
|
|
}
|