README
detrail
detrail
is a small command line utility to remove trailing whitespace from source code files and direct the resultant text to standard output.
Installation
$ npm install -g detrail
Usage
Reading a source file by path:
$ detrail my-source-file.js
# Trailing whitespace-trimmed output is printed to stdout
Reading from stdin:
$ detrail < my-source-file.js
# Trailing whitespace-trimmed output is printed to stdout
Fix an input file (e.g. overwrite it with trailing whitespace removed):
$ detrail --fix my-source-file.js
# my-source-file.js will be overwritten
Development
PRs are always welcome!
$ git clone https://github.com/LINKIWI/detrail.git
To run the linter and tests:
$ npm install
$ npm run test
Alternatively, with coverage:
$ npm run cover
FAQ
sed
?
Why can't I just use You can absolutely just use sed
.
$ sed 's/\s*$//g' file.ext > newfile.ext
In fact, I encourage you to do so if this fits your workflow; detrail
is only meant to be a simple, easily-installable executable to wrap this logic. Primarily, this command requires you to either remember, rewrite, or alias this regular expression every time you want to use it.