RazrFalcon / svgcleaner

svgcleaner could help you to clean up your SVG files from the unnecessary data.
GNU General Public License v2.0
1.62k stars 93 forks source link

Add an option to leave a newline at the end of files #199

Closed aaronfranke closed 4 years ago

aaronfranke commented 5 years ago

The POSIX standard for text files is that each line is "A sequence of zero or more non-\<newline> characters plus a terminating \<newline> character". Files output by svgcleaner currently don't contain a newline character (\n) at the end of the file, which breaks displaying the file with cat or similar in terminals, and shows warnings elsewhere (including GitHub).

For more information, check out this StackOverflow question: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

My proposal is to add a setting to append newlines to the end of each file. This adds exactly one byte to every file, so it makes sense to be disabled by default, due to the purpose of svgcleaner being to absolutely minify the SVG, yet allowing this would be great to avoid warnings and potential issues. This would probably go under the "Output" section of the --help page.

RazrFalcon commented 5 years ago

Yes, makes sense.