github.com/khulnasoft-lab/kube-bench@v0.2.1-0.20240330183753-9df52345ae58/cmd/version.go (about)

     1  package cmd
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  var KubeBenchVersion string
    10  
    11  // versionCmd represents the version command
    12  var versionCmd = &cobra.Command{
    13  	Use:   "version",
    14  	Short: "Shows the version of kube-bench.",
    15  	Long:  `Shows the version of kube-bench.`,
    16  	Run: func(cmd *cobra.Command, args []string) {
    17  		fmt.Println(KubeBenchVersion)
    18  	},
    19  }
    20  
    21  func init() {
    22  	RootCmd.AddCommand(versionCmd)
    23  }