From 17e822757b39fa6718a254d48e1d7121998e430a Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 24 Jan 2017 21:19:45 +0400 Subject: [PATCH 1/2] output all commands --- cmd/tendermint/main.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/tendermint/main.go b/cmd/tendermint/main.go index 2338ad393..cc57aa812 100644 --- a/cmd/tendermint/main.go +++ b/cmd/tendermint/main.go @@ -4,7 +4,6 @@ import ( "fmt" "os" - . "github.com/tendermint/go-common" cfg "github.com/tendermint/go-config" "github.com/tendermint/go-logger" tmcfg "github.com/tendermint/tendermint/config/tendermint" @@ -21,11 +20,16 @@ func main() { fmt.Println(`Tendermint Commands: - node Run the tendermint node - show_validator Show this node's validator info - gen_validator Generate new validator keypair - probe_upnp Test UPnP functionality - version Show version info + init Initialize tendermint + node Run the tendermint node + show_validator Show this node's validator info + gen_validator Generate new validator keypair + probe_upnp Test UPnP functionality + replay Replay messages from WAL + replay_console Replay messages from WAL in a console + unsafe_reset_all (unsafe) Remove all the data and WAL, reset this node's validator + unsafe_reset_priv_validator (unsafe) Reset this node's validator + version Show version info `) return } @@ -59,6 +63,7 @@ Commands: case "version": fmt.Println(version.Version) default: - Exit(Fmt("Unknown command %v\n", args[0])) + fmt.Printf("Unknown command %v\n", args[0]) + os.Exit(1) } } From 3b7a1d7149ad70de74354e04e853362bd6d31e72 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 24 Jan 2017 21:20:29 +0400 Subject: [PATCH 2/2] check that we have enough arguments Otherwise: ``` panic: runtime error: index out of range goroutine 1 [running]: panic(0xbb8de0, 0xc82000e080) /usr/local/go/src/runtime/panic.go:464 +0x3e6 main.main() /go/src/github.com/tendermint/tendermint/cmd/tendermint/main.go:48 +0x811 ``` --- cmd/tendermint/main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/tendermint/main.go b/cmd/tendermint/main.go index cc57aa812..640f2c275 100644 --- a/cmd/tendermint/main.go +++ b/cmd/tendermint/main.go @@ -45,9 +45,19 @@ Commands: case "node": run_node(config) case "replay": - consensus.RunReplayFile(config, args[1], false) + if len(args) > 1 { + consensus.RunReplayFile(config, args[1], false) + } else { + fmt.Println("replay requires an argument (walfile)") + os.Exit(1) + } case "replay_console": - consensus.RunReplayFile(config, args[1], true) + if len(args) > 1 { + consensus.RunReplayFile(config, args[1], true) + } else { + fmt.Println("replay_console requires an argument (walfile)") + os.Exit(1) + } case "init": init_files() case "show_validator":