The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/cmd/harmony/version.go

47 lines
828 B

package main
import (
"fmt"
"os"
"github.com/harmony-one/harmony/internal/cli"
"github.com/spf13/cobra"
)
const (
versionFormat = "Harmony (C) 2023. %v, version %v-%v (%v %v)"
)
// Version string variables
var (
version string
builtBy string
builtAt string
commit string
)
var versionFlag = cli.BoolFlag{
Name: "version",
Shorthand: "V",
Usage: "display version info",
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "print version of the harmony binary",
Long: "print version of the harmony binary",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
printVersion()
os.Exit(0)
},
}
func getHarmonyVersion() string {
return fmt.Sprintf(versionFormat, "harmony", version, commit, builtBy, builtAt)
}
func printVersion() {
fmt.Println(getHarmonyVersion())
}