Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
37
cloud/maplefile-backend/cmd/version.go
Normal file
37
cloud/maplefile-backend/cmd/version.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Build information set at compile time
|
||||
var (
|
||||
version = "1.0.0"
|
||||
gitCommit = "unknown"
|
||||
buildTime = "unknown"
|
||||
)
|
||||
|
||||
// SetBuildInfo sets the build information from main package
|
||||
func SetBuildInfo(v, commit, time string) {
|
||||
version = v
|
||||
gitCommit = commit
|
||||
buildTime = time
|
||||
}
|
||||
|
||||
// GetBuildInfo returns the current build information
|
||||
func GetBuildInfo() (string, string, string) {
|
||||
return version, gitCommit, buildTime
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version number",
|
||||
Long: `Print the version number of MapleFile backend.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("MapleFile Backend v%s\n", version)
|
||||
fmt.Printf("Git Commit: %s\n", gitCommit)
|
||||
fmt.Printf("Build Time: %s\n", buildTime)
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue