mirror of
https://github.com/cosinekitty/astronomy.git
synced 2025-12-23 23:58:15 -05:00
Also added missing check in Python apsis test where I did not verify that each apsis kind was correct.
31 lines
852 B
JavaScript
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);
|