Closed ghost closed 6 years ago
Figured something out. It's not perfect, but it's better than it was.
Line 228 of Out-File.ps1:
if ($i -ne $script:NoSection) { Add-Content -Value "`r`n[$i]" @parameters }
Was:
if ($i -ne $script:NoSection) { Add-Content -Value "`n[$i]" @parameters }
Note the missing carriage return. This adds a line at the top of the file, too, but that's not a big deal.
Hi @mtthwjrgnsn
Thank you for the suggestion.
I will definitely not preserve them, as that would mean I had to track and store them when reading the input file.
I will however add a -Pretty
parameter to Out-IniFile
. How this helps you
Would it be possible to preserve whitespace between sections?
For example, before the script touches an INI file, it could look like this:
After the script is done, all the white space is gone:
Makes readability more difficult after batch-editing a bunch of INIs.