github.com/rajasrinivasan/spm@v0.0.0-20200125100127-755649755f3f/src/cmd/version.go (about)

     1  package cmd
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  // installCmd represents the install command
    10  var versionCmd = &cobra.Command{
    11  	Use:   "version",
    12  	Short: "Report version",
    13  	Long:  `Report version`,
    14  	Run:   version,
    15  }
    16  
    17  func init() {
    18  
    19  	rootCmd.AddCommand(versionCmd)
    20  }
    21  
    22  func version(cmd *cobra.Command, args []string) {
    23  	fmt.Printf("Version %d.%d-%d Built %s\n", versionMajor, versionMinor, versionBuild, buildTime)
    24  }