Skip to content

Commit

Permalink
a little more cleanup
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
  • Loading branch information
whyrusleeping committed Jul 9, 2016
1 parent c142534 commit 9ff238e
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions commands/cli/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,10 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
case cmds.ArgString:
if len(inputs) > 0 {
stringArgs, inputs = append(stringArgs, inputs[0]), inputs[1:]
} else {
if stdin != nil && argDef.SupportsStdin && !fillingVariadic {
if err := printReadInfo(stdin, msgStdinInfo); err == nil {
fileArgs[stdin.Name()] = files.NewReaderFile("stdin", "", stdin, nil)
stdin = nil
}
} else if stdin != nil && argDef.SupportsStdin && !fillingVariadic {
if err := printReadInfo(stdin, msgStdinInfo); err == nil {
fileArgs[stdin.Name()] = files.NewReaderFile("stdin", "", stdin, nil)
stdin = nil
}
}
case cmds.ArgFile:
Expand All @@ -332,17 +330,13 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
}

fileArgs[fpath] = file
} else {
if stdin != nil && argDef.SupportsStdin &&
argDef.Required && !fillingVariadic {
if err := printReadInfo(stdin, msgStdinInfo); err != nil {
return nil, nil, err
}
fpath := stdin.Name()
fileArgs[fpath] = files.NewReaderFile("", fpath, stdin, nil)
} else {
break
} else if stdin != nil && argDef.SupportsStdin &&
argDef.Required && !fillingVariadic {
if err := printReadInfo(stdin, msgStdinInfo); err != nil {
return nil, nil, err
}
fpath := stdin.Name()
fileArgs[fpath] = files.NewReaderFile("", fpath, stdin, nil)
}
}

Expand Down

0 comments on commit 9ff238e

Please sign in to comment.