From 032ab665299d75bffc25260e8fa477ace19db06a Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 7 Jan 2015 01:21:55 +0100 Subject: [PATCH] Added version flag --- cmd/ethereum/flags.go | 2 ++ cmd/ethereum/main.go | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 57e5d8b8c1..f829744dc9 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -64,6 +64,7 @@ var ( ImportChain string SHH bool Dial bool + PrintVersion bool ) // flags specific to cli client @@ -120,6 +121,7 @@ func Init() { flag.BoolVar(&StartMining, "mine", false, "start dagger mining") flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console") + flag.BoolVar(&PrintVersion, "version", false, "prints version number") flag.Parse() diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 481914aead..3243cc7fb2 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -52,6 +52,11 @@ func main() { // precedence: code-internal flag default < config file < environment variables < command line Init() // parsing command line + if PrintVersion { + printVersion() + return + } + utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ @@ -137,3 +142,13 @@ func main() { // this blocks the thread ethereum.WaitForShutdown() } + +func printVersion() { + fmt.Printf(`%v %v +PV=%d +GOOS=%s +GO=%s +GOPATH=%s +GOROOT=%s +`, ClientIdentifier, Version, eth.ProtocolVersion, runtime.GOOS, runtime.Version(), os.Getenv("GOPATH"), runtime.GOROOT()) +}