From 28be8a617122914c83642468cdf3370f6be2216d Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Mon, 10 Nov 2014 22:25:19 -0800 Subject: [PATCH] refactor(ipfs2/main) check err before --- cmd/ipfs2/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/ipfs2/main.go b/cmd/ipfs2/main.go index 23ec2b62c..3b1512e58 100644 --- a/cmd/ipfs2/main.go +++ b/cmd/ipfs2/main.go @@ -119,7 +119,12 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) { func handleOptions(req cmds.Request, root *cmds.Command) { help, err := req.Option("help").Bool() - if help && err == nil { + if err != nil { + fmt.Println(err) + exit(1) + } + + if help { helpText, err := cmdsCli.HelpText("ipfs", root, req.Path()) if err != nil { fmt.Println(err.Error()) @@ -127,9 +132,6 @@ func handleOptions(req cmds.Request, root *cmds.Command) { fmt.Println(helpText) } exit(0) - } else if err != nil { - fmt.Println(err) - exit(1) } if debug, err := req.Option("debug").Bool(); debug && err == nil {