A dead simple CLI to remove trailing whitespace from files. Inspired by the UNIX philoshophy and the fact that I somehow keep leaving whitespaces when taking notes in Emacs.
Assuming you have the Rust toolchain setup, you can compile it from source and install via cargo:
cargo install --locked --git https://github.com/vvzen/trim-whitespace-rsThe installed binary will be called trim.
Soon enough I might set up a CI for it.
Trim some-file.txt in place:
trim -i some-file.txtYou can also pass multiple files:
trim -i my-file-a.txt my-file-b.txtTrim data passed to stdin:
echo -n 'hello, world ' | trim -For example:
$ echo -e 'hello, world \nbonjour, globe' | hexdump -c
0000000 h e l l o , w o r l d \n
0000010 b o n j o u r , g l o b e \n
000001f
$ echo -e 'hello, world \nbonjour, globe' | trim - | hexdump -c
0000000 h e l l o , w o r l d \n b o n
0000010 j o u r , g l o b e \n
000001c