From 5e7d003dd8ae828f8573b9f24157a101123b4416 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Sat, 15 Dec 2018 06:13:51 +0000 Subject: [PATCH] add -version support in wallet Signed-off-by: Leo Chen --- client/wallet/main.go | 15 +++++++++++++++ go_executable_build.sh | 1 + 2 files changed, 16 insertions(+) diff --git a/client/wallet/main.go b/client/wallet/main.go index 813526419..af1e0f139 100644 --- a/client/wallet/main.go +++ b/client/wallet/main.go @@ -27,10 +27,23 @@ import ( "io" "io/ioutil" "os" + "path" "strconv" "time" ) +var ( + version string + builtBy string + builtAt string + commit string +) + +func printVersion(me string) { + fmt.Fprintf(os.Stderr, "Harmony (C) 2018. %v, version %v-%v (%v %v)\n", path.Base(me), version, commit, builtBy, builtAt) + os.Exit(0) +} + // AccountState includes the state of an account type AccountState struct { balance *big.Int @@ -81,6 +94,8 @@ func main() { // Switch on the subcommand switch os.Args[1] { + case "-version": + printVersion(os.Args[0]) case "new": randomBytes := [32]byte{} _, err := io.ReadFull(rand.Reader, randomBytes[:]) diff --git a/go_executable_build.sh b/go_executable_build.sh index 0428f9317..ec5b172a5 100755 --- a/go_executable_build.sh +++ b/go_executable_build.sh @@ -3,6 +3,7 @@ declare -A SRC SRC[benchmark]=benchmark.go SRC[txgen]=client/txgen/main.go SRC[beacon]=beaconchain/main/main.go +SRC[wallet]=client/wallet/main.go BINDIR=bin BUCKET=unique-bucket-bin