From edac479e7dc1151f2d0d6f1b65c3265b03ae7b5a Mon Sep 17 00:00:00 2001 From: jahway603 Date: Thu, 21 Oct 2021 16:07:14 -0400 Subject: [PATCH] changed to variable --- build.sh | 6 +++--- cmd/server/main.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index f9a9794..7a47e44 100755 --- a/build.sh +++ b/build.sh @@ -20,10 +20,10 @@ echo "+------'+------'+------'+------'+------'+------'+------'+------'+------'+- # now to compiling... echo "" -echo "You have go installed, so starting to compile hush lightwalletd for you..." +echo "You have go installed, so starting to compile Hush lightwalletd for you..." cd `pwd`/cmd/server go build -o lightwalletd main.go mv lightwalletd `pwd`/../../lightwalletd echo "" -echo "lightwalletd is now compiled for you." -echo "for options, run ./lightwalletd --help" +echo "Hush lightwalletd is now compiled for you. Enjoy and reach out if you need support." +echo "For options, run ./lightwalletd --help" diff --git a/cmd/server/main.go b/cmd/server/main.go index 1c72be3..fb4be3a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -88,6 +88,8 @@ type Options struct { } func main() { + var version = "0.1.1" // set version number + opts := &Options{} flag.StringVar(&opts.bindAddr, "bind-addr", "127.0.0.1:9069", "the address to listen on") flag.StringVar(&opts.tlsCertPath, "tls-cert", "", "the path to a TLS certificate (optional)") @@ -98,13 +100,11 @@ func main() { flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from") flag.IntVar(&opts.cacheSize, "cache-size", 40000, "number of blocks to hold in the cache") - // creating --version so help2man will work + // creating --version as a requirement of help2man if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") { - // TODO find a better method than hardcode the version number here - fmt.Printf("hush lightwalletd version 0.1.1\n") + fmt.Printf("Hush lightwalletd version " + version + "\n") os.Exit(0) } - // TODO determine why help2man is now complaining about --help even after I tried creating one... // TODO prod metrics // TODO support config from file and env vars