@cryptotaxi247 / kubo / commits / 2f2efc846

cmd/ipfs: On command ClientError, suggest checking helptext instead of showing short helptext. Resovles #630

Matt Bell committed Jan 24, 2015 at 14:52 UTC 2f2efc8463b89bea50b5435dca5d9a3399974f54
1 file changed +9 -2
cmd/ipfs/main.go
+9 -2
@@ -9,6 +9,7 @@ import (
9 "os/signal"
10 "runtime"
11 "runtime/pprof"
12 + "strings"
13 "syscall"
14 "time"
15
@@ -78,6 +79,12 @@ func main() {
79 helpFunc("ipfs", Root, invoc.path, w)
80 }
81
82 + // this is a message to tell the user how to get the help text
83 + printMetaHelp := func(w io.Writer) {
84 + cmdPath := strings.Join(invoc.path, " ")
85 + fmt.Fprintf(w, "Use 'ipfs %s --help' for information about this command\n", cmdPath)
86 + }
87 +
88 // parse the commandline into a command invocation
89 parseErr := invoc.Parse(ctx, os.Args[1:])
90
@@ -112,7 +119,7 @@ func main() {
119 if invoc.cmd != nil {
120 // we need a newline space.
121 fmt.Fprintf(os.Stderr, "\n")
115 - printHelp(false, os.Stderr)
122 + printMetaHelp(os.Stderr)
123 }
124 os.Exit(1)
125 }
@@ -124,7 +131,7 @@ func main() {
131
132 // if this error was a client error, print short help too.
133 if isClientError(err) {
127 - printHelp(false, os.Stderr)
134 + printMetaHelp(os.Stderr)
135 }
136 os.Exit(1)
137 }