Skip to content

Commit 032ab66

Browse files
committed
Added version flag
1 parent 60d9611 commit 032ab66

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cmd/ethereum/flags.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var (
6464
ImportChain string
6565
SHH bool
6666
Dial bool
67+
PrintVersion bool
6768
)
6869

6970
// flags specific to cli client
@@ -120,6 +121,7 @@ func Init() {
120121

121122
flag.BoolVar(&StartMining, "mine", false, "start dagger mining")
122123
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")
124+
flag.BoolVar(&PrintVersion, "version", false, "prints version number")
123125

124126
flag.Parse()
125127

cmd/ethereum/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ func main() {
5252
// precedence: code-internal flag default < config file < environment variables < command line
5353
Init() // parsing command line
5454

55+
if PrintVersion {
56+
printVersion()
57+
return
58+
}
59+
5560
utils.InitConfig(VmType, ConfigFile, Datadir, "ETH")
5661

5762
ethereum, err := eth.New(&eth.Config{
@@ -137,3 +142,13 @@ func main() {
137142
// this blocks the thread
138143
ethereum.WaitForShutdown()
139144
}
145+
146+
func printVersion() {
147+
fmt.Printf(`%v %v
148+
PV=%d
149+
GOOS=%s
150+
GO=%s
151+
GOPATH=%s
152+
GOROOT=%s
153+
`, ClientIdentifier, Version, eth.ProtocolVersion, runtime.GOOS, runtime.Version(), os.Getenv("GOPATH"), runtime.GOROOT())
154+
}

0 commit comments

Comments
 (0)