cmd/ipfs2: Display subcommand help text on parse error
Matt Bell committed
Nov 4, 2014 at 18:56 UTC
1cb94a1231709744f1bb1f87c119cb2729422d4f
1 file changed
+8
-2
cmd/ipfs2/main.go
+8
-2
@@ -40,10 +40,16 @@ func main() {
40
}
41
42
func createRequest(args []string) (cmds.Request, *cmds.Command) {
43
- req, root, err := cmdsCli.Parse(args, Root, commands.Root)
43
+ req, root, cmd, err := cmdsCli.Parse(args, Root, commands.Root)
44
if err != nil {
45
fmt.Println(err)
46
- fmt.Println(Root.Help)
46
+ if cmd != nil {
47
+ if cmd.Help != "" {
48
+ fmt.Println(cmd.Help)
49
+ }
50
+ } else {
51
+ fmt.Println(Root.Help)
52
+ }
53
os.Exit(1)
54
}
55