From 942e96400bfceba3ef7b4e57002c44d8a718ecbf Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 17 May 2015 23:43:24 +0200 Subject: [PATCH] parse: fix parsing stdin args License: MIT Signed-off-by: Christian Couder --- commands/cli/parse.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/cli/parse.go b/commands/cli/parse.go index 06c6d477c..c512e64bc 100644 --- a/commands/cli/parse.go +++ b/commands/cli/parse.go @@ -250,11 +250,11 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi var err error if argDef.Type == cmds.ArgString { - if stdin == nil { + if stdin == nil || !argDef.SupportsStdin { // add string values stringArgs, inputs = appendString(stringArgs, inputs) - } else if argDef.SupportsStdin { + } else { if len(inputs) > 0 { // don't use stdin if we have inputs stdin = nil @@ -267,14 +267,14 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi } } } else if argDef.Type == cmds.ArgFile { - if stdin == nil { + if stdin == nil || !argDef.SupportsStdin { // treat stringArg values as file paths fileArgs, inputs, err = appendFile(fileArgs, inputs, argDef, recursive) if err != nil { return nil, nil, err } - } else if argDef.SupportsStdin { + } else { if len(inputs) > 0 { // don't use stdin if we have inputs stdin = nil