提交 2f2efc84 作者: Matt Bell

cmd/ipfs: On command ClientError, suggest checking helptext instead of showing…

cmd/ipfs: On command ClientError, suggest checking helptext instead of showing short helptext. Resovles #630
上级 23f810e1
......@@ -9,6 +9,7 @@ import (
"os/signal"
"runtime"
"runtime/pprof"
"strings"
"syscall"
"time"
......@@ -78,6 +79,12 @@ func main() {
helpFunc("ipfs", Root, invoc.path, w)
}
// this is a message to tell the user how to get the help text
printMetaHelp := func(w io.Writer) {
cmdPath := strings.Join(invoc.path, " ")
fmt.Fprintf(w, "Use 'ipfs %s --help' for information about this command\n", cmdPath)
}
// parse the commandline into a command invocation
parseErr := invoc.Parse(ctx, os.Args[1:])
......@@ -112,7 +119,7 @@ func main() {
if invoc.cmd != nil {
// we need a newline space.
fmt.Fprintf(os.Stderr, "\n")
printHelp(false, os.Stderr)
printMetaHelp(os.Stderr)
}
os.Exit(1)
}
......@@ -124,7 +131,7 @@ func main() {
// if this error was a client error, print short help too.
if isClientError(err) {
printHelp(false, os.Stderr)
printMetaHelp(os.Stderr)
}
os.Exit(1)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论