mirror of
https://github.com/mikefarah/yq.git
synced 2026-06-27 23:49:58 +00:00
When using --split-exp to split documents into per-file outputs, yq silently overwrites any pre-existing files at the target paths because os.Create truncates. For workflows that generate filenames from input data (e.g. '.metadata.name + ".yml"'), this can clobber unrelated files when two documents map to the same name, or when a target path collides with something already on disk. This change adds an opt-in --split-exp-no-overwrite flag (and a matching yqlib constructor NewMultiPrinterWriterWithOptions) that uses O_WRONLY|O_CREATE|O_EXCL so existing files are left untouched and yq exits with a clear error message instead. The default behaviour (overwrite) is unchanged; the original NewMultiPrinterWriter constructor still exists and now delegates to the new options-aware constructor with noOverwrite=false. Fixes #2028 |
||
|---|---|---|
| .. | ||
| completion.go | ||
| constant.go | ||
| evaluate_all_command_test.go | ||
| evaluate_all_command.go | ||
| evaluate_sequence_command_test.go | ||
| evaluate_sequence_command.go | ||
| root_test.go | ||
| root.go | ||
| unwrap_flag.go | ||
| utils_test.go | ||
| utils.go | ||
| version_test.go | ||
| version.go | ||