Skip to content

Commit

Permalink
fix: jsonrpc2client -version
Browse files Browse the repository at this point in the history
  • Loading branch information
powerman committed May 24, 2019
1 parent 4e25cc6 commit c72a4f8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/jsonrpc2client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ func main() {
}
flag.Parse()

if len(flag.Args()) != 2 {
FatalUsage("")
}
method, paramsJSON := flag.Arg(0), flag.Arg(1)
var params interface{}
err := json.Unmarshal([]byte(paramsJSON), &params)

switch {
case cfg.version:
fmt.Println(cmd, ver, runtime.Version())
os.Exit(0)
case len(flag.Args()) != 2:
FatalUsage("")
case method == "":
FatalUsage("method: required\n")
case err != nil:
Expand All @@ -67,9 +69,6 @@ func main() {
FatalFlagValue("must be endpoint", "http.endpoint", cfg.httpEndpoint)
case cfg.transport == transportTCP && cfg.tcpAddr == "":
FatalFlagValue("required", "tcp.addr", cfg.tcpAddr)
case cfg.version: // Must be checked after all other flags for ease testing.
fmt.Println(cmd, ver, runtime.Version())
os.Exit(0)
}

var client *jsonrpc2.Client
Expand Down

0 comments on commit c72a4f8

Please sign in to comment.