1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 03:19:47 +08:00
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy
2016-07-08 16:04:42 -07:00
parent 467eb8db00
commit cd46743717
2 changed files with 29 additions and 32 deletions

View File

@ -17,6 +17,11 @@ import (
var log = logging.Logger("commands/cli")
// stdinSpecialName is a name applied to the 'stdin' file so we can differentiate
// it from potential 'real' files being passed in. The '*' character is invalid in
// path names and won't appear otherwise.
const stdinSpecialName = "*stdin*"
// Parse parses the input commandline string (cmd, flags, and args).
// returns the corresponding command Request object.
func Parse(input []string, stdin *os.File, root *cmds.Command) (cmds.Request, *cmds.Command, []string, error) {
@ -302,7 +307,7 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
return nil, nil, err
}
if istty {
fname = "*stdin*"
fname = stdinSpecialName
}
fileArgs[stdin.Name()] = files.NewReaderFile(fname, "", stdin, nil)