mirror of
https://github.com/mikefarah/yq.git
synced 2026-06-27 15:37:47 +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 |
||
|---|---|---|
| .. | ||
| yqlib | ||