tomnomnom / anew

A tool for adding new lines to files, skipping duplicates
MIT License
1.34k stars 147 forks source link

Add trim to prevent dupes from whitespace #14

Closed thesurlydev closed 2 years ago

thesurlydev commented 2 years ago

This change adds a bool flag to indicate that the lines should be trimmed prior to comparison. This is helpful for preventing duplicates if there's a leading or trailing space in either the existing file line or candidate line being passed in.

Here's an example of the usage:

echo "foo" | anew -t bar.txt

where bar.txt contains 'foo ' (with trailing whitespace). In this case, the "foo" piped to anew will not get appended to bar.txt.

This closes #13

thesurlydev commented 2 years ago

@tomnomnom Any chance to get this merged?

tomnomnom commented 2 years ago

Thank you for your PR! Apologies it took so long to be merged