Error when passing files and using null-input flag

This commit is contained in:
Mike Farah 2021-01-09 12:23:06 +11:00
parent 316e0d4d5a
commit 7fa2b20b48
2 changed files with 8 additions and 0 deletions

View File

@ -59,6 +59,10 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
defer func() { writeInPlaceHandler.FinishWriteInPlace(completedSuccessfully) }()
}
if nullInput && len(args) > 1 {
return errors.New("Cannot pass files in when using null-input flag")
}
printer := yqlib.NewPrinter(out, outputToJSON, unwrapScalar, colorsEnabled, indent, !noDocSeparators)
allAtOnceEvaluator := yqlib.NewAllAtOnceEvaluator()

View File

@ -83,6 +83,10 @@ func evaluateSequence(cmd *cobra.Command, args []string) error {
streamEvaluator := yqlib.NewStreamEvaluator()
if nullInput && len(args) > 1 {
return errors.New("Cannot pass files in when using null-input flag")
}
switch len(args) {
case 0:
if pipingStdIn {