github.com/cheikhshift/buffalo@v0.9.5/buffalo/cmd/version.go (about)

     1  package cmd
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  // Version is the current version of the buffalo binary
    10  const Version = "v0.9.5"
    11  
    12  func init() {
    13  	decorate("version", versionCmd)
    14  	RootCmd.AddCommand(versionCmd)
    15  }
    16  
    17  var versionCmd = &cobra.Command{
    18  	Use:   "version",
    19  	Short: "Print the version number of buffalo",
    20  	Long:  `All software has versions.  This is buffalo's.`,
    21  	Run: func(c *cobra.Command, args []string) {
    22  		fmt.Printf("Buffalo version is: %s\n", Version)
    23  	},
    24  	// needed to override the root level pre-run func
    25  	PersistentPreRunE: func(c *cobra.Command, args []string) error {
    26  		return nil
    27  	},
    28  }