diff --git a/commands_test.go b/commands_test.go index c310d59e..9f600f38 100644 --- a/commands_test.go +++ b/commands_test.go @@ -1337,6 +1337,21 @@ c: ` test.AssertResult(t, expectedOutput, result.Output) } + +func TestMergeOverwriteAndAppendCmd(t *testing.T) { + cmd := getRootCommand() + result := test.RunCmd(cmd, "merge --autocreate=false --append --overwrite examples/data1.yaml examples/data2.yaml") + if result.Error != nil { + t.Error(result.Error) + } + expectedOutput := `a: other # better than the original +b: [1, 2, 3, 4] +c: + test: 1 +` + test.AssertResult(t, expectedOutput, result.Output) +} + func TestMergeArraysCmd(t *testing.T) { cmd := getRootCommand() result := test.RunCmd(cmd, "merge --append examples/sample_array.yaml examples/sample_array_2.yaml") diff --git a/yq.go b/yq.go index adfd05f6..053b4a98 100644 --- a/yq.go +++ b/yq.go @@ -231,8 +231,6 @@ Outputs to STDOUT unless the inplace flag is used, in which case the file is upd If overwrite flag is set then existing values will be overwritten using the values from each additional yaml file. If append flag is set then existing arrays will be merged with the arrays from each additional yaml file. - -Note that if you set both flags only overwrite will take effect. `, RunE: mergeProperties, }