Commit 28be8a61 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

refactor(ipfs2/main) check err before

parent f79f1267
...@@ -119,7 +119,12 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) { ...@@ -119,7 +119,12 @@ func createRequest(args []string) (cmds.Request, *cmds.Command, error) {
func handleOptions(req cmds.Request, root *cmds.Command) { func handleOptions(req cmds.Request, root *cmds.Command) {
help, err := req.Option("help").Bool() 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()) helpText, err := cmdsCli.HelpText("ipfs", root, req.Path())
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
...@@ -127,9 +132,6 @@ func handleOptions(req cmds.Request, root *cmds.Command) { ...@@ -127,9 +132,6 @@ func handleOptions(req cmds.Request, root *cmds.Command) {
fmt.Println(helpText) fmt.Println(helpText)
} }
exit(0) exit(0)
} else if err != nil {
fmt.Println(err)
exit(1)
} }
if debug, err := req.Option("debug").Bool(); debug && err == nil { if debug, err := req.Option("debug").Bool(); debug && err == nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment