提交 050985c5 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3134 from ipfs/fix/cmd/repeated-help-text

cli: Fix stdin help text being show multiple times
...@@ -251,7 +251,7 @@ func parseOpts(args []string, root *cmds.Command) ( ...@@ -251,7 +251,7 @@ func parseOpts(args []string, root *cmds.Command) (
return return
} }
const msgStdinInfo = "ipfs: Reading from %s; send Ctrl-d to stop.\n" const msgStdinInfo = "ipfs: Reading from %s; send Ctrl-d to stop."
func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursive, hidden bool, root *cmds.Command) ([]string, []files.File, error) { func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursive, hidden bool, root *cmds.Command) ([]string, []files.File, error) {
// ignore stdin on Windows // ignore stdin on Windows
...@@ -469,6 +469,7 @@ func newMessageReader(r io.ReadCloser, msg string) io.ReadCloser { ...@@ -469,6 +469,7 @@ func newMessageReader(r io.ReadCloser, msg string) io.ReadCloser {
func (r *messageReader) Read(b []byte) (int, error) { func (r *messageReader) Read(b []byte) (int, error) {
if !r.done { if !r.done {
fmt.Fprintln(os.Stderr, r.message) fmt.Fprintln(os.Stderr, r.message)
r.done = true
} }
return r.r.Read(b) return r.r.Read(b)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论