github.com/cozy/cozy-stack@v0.0.0-20240327093429-939e4a21320e/cmd/version.go (about)

     1  package cmd
     2  
     3  import (
     4  	"fmt"
     5  
     6  	build "github.com/cozy/cozy-stack/pkg/config"
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  var versionCmd = &cobra.Command{
    11  	Use:   "version",
    12  	Short: "Print the version number",
    13  	Long:  `Print the current version number of the binary`,
    14  	RunE: func(cmd *cobra.Command, args []string) error {
    15  		fmt.Println(build.Version)
    16  		return nil
    17  	},
    18  }
    19  
    20  func init() {
    21  	RootCmd.AddCommand(versionCmd)
    22  }