@cryptotaxi247 / kubo / commits / 28be8a617

refactor(ipfs2/main) check err before

Brian Tiger Chow committed Nov 10, 2014 at 22:25 UTC 28be8a617122914c83642468cdf3370f6be2216d
1 file changed +6 -4
cmd/ipfs2/main.go
+6 -4
@@ -119,7 +119,12 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) {
119
120 func handleOptions(req cmds.Request, root *cmds.Command) {
121 help, err := req.Option("help").Bool()
122 - if help && err == nil {
122 + if err != nil {
123 + fmt.Println(err)
124 + exit(1)
125 + }
126 +
127 + if help {
128 helpText, err := cmdsCli.HelpText("ipfs", root, req.Path())
129 if err != nil {
130 fmt.Println(err.Error())
@@ -127,9 +132,6 @@ func handleOptions(req cmds.Request, root *cmds.Command) {
132 fmt.Println(helpText)
133 }
134 exit(0)
130 - } else if err != nil {
131 - fmt.Println(err)
132 - exit(1)
135 }
136
137 if debug, err := req.Option("debug").Bool(); debug && err == nil {