Written by marcelpetrick
on February 26, 2019
(for CMake/C++-projects)
Find all fitting files and run the fixer-script in parallel over it.
1 |
( find . -name "CMakeLists.txt" ; find . -name "*.cmake" ; find . -name "*.h" ; find . -name "*.cpp" ) | parallel --bar ../removeTrailing.sh |
After playing for a while with sed and awk and not being able to get a fitting solution, I decided to create my own as python-script. It squashes all consecutive double-whitespace-lines (and adds one to the end if missing).
Or “run it on the files changed for the last commit”:
1 |
$ git diff --name-only HEAD~1 HEAD | parallel --bar ../removeTrailing.sh |
Sources:
removeTrainling.sh
squashMultipleWhitespace.py
How to get GNU parallel (developed by Ole Tange):
1 |
(wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - http://pi.dk/3) | bash |