diff --git a/commands/cli/parse.go b/commands/cli/parse.go index 92be53fa669246e36fe20094435ca5078e602cf6..4ff7103a0b4ef9e197fe47fc1bcd58eb94c1a392 100644 --- a/commands/cli/parse.go +++ b/commands/cli/parse.go @@ -219,9 +219,11 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi } } - // count number of values provided by user + // count number of values provided by user. + // if there is at least one ArgDef, we can safely trigger the inputs loop + // below to parse stdin. numInputs := len(inputs) - if stdin != nil { + if argDef := getArgDef(0, argDefs); argDef != nil && stdin != nil { numInputs += 1 }