Add version information
This commit is contained in:
parent
422448006e
commit
058139cea2
3 changed files with 13 additions and 2 deletions
|
@ -30,6 +30,7 @@ var log = logrus.New()
|
|||
var (
|
||||
cfgFile string
|
||||
logLevel string
|
||||
Version string
|
||||
)
|
||||
|
||||
// RootCmd represents the base command when called without any subcommands
|
||||
|
|
|
@ -25,7 +25,7 @@ var versionCmd = &cobra.Command{
|
|||
Short: "Print the version number of php-fpm_exporter",
|
||||
Long: `All software has versions. This is php-fpm_exporter's'`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("php-fpm_exporter v0.9 -- HEAD")
|
||||
fmt.Printf("php-fpm_exporter %v\n", Version)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
12
main.go
12
main.go
|
@ -13,8 +13,18 @@
|
|||
|
||||
package main
|
||||
|
||||
import "github.com/hipages/php-fpm_exporter/cmd"
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hipages/php-fpm_exporter/cmd"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "dev"
|
||||
commit = "none"
|
||||
date = "unknown"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd.Version = fmt.Sprintf("%v, commit %v, built at %v", version, commit, date)
|
||||
cmd.Execute()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue