Files
astronomy/generate/trimspace.js
Don Cross 8c590e4449 Python: implemented InverseRotation function. Cleaned up trailing whitespace.
Also added missing check in Python apsis test where
I did not verify that each apsis kind was correct.
2019-12-15 20:23:35 -05:00

31 lines
852 B
JavaScript

/*
trimspace.js - Don Cross
Trim all trailing whitespace from every line in a text file.
This is to help me automatically clean up source code before
feeding it through doxygen, because that has caused issues
in Windows builds.
*/
'use strict';
const fs = require('fs');
function FixFile(filename) {
const inText = fs.readFileSync(filename, 'utf8');
const outText = inText.replace(/[ \t]+(\r?\n)/g, '$1');
if (inText === outText) {
console.log(`trimspace.js: Leaving file as-is: ${filename}`);
} else {
fs.writeFileSync(filename, outText, 'utf8');
console.log(`trimspace.js: Removed trailing whitespace from file: ${filename}`);
}
}
if (process.argv.length !== 3) {
console.log('USAGE: trimspace.js filename');
process.exit(1);
}
FixFile(process.argv[2]);
process.exit(0);