refactor(ipfs2/main) check err before

This commit is contained in:
Brian Tiger Chow 2014-11-10 22:25:19 -08:00 committed by Juan Batiz-Benet
parent f79f1267f7
commit 28be8a6171

View File

@ -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 {