Files
astronomy/generate/eol_hack.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

33 lines
850 B
JavaScript

/*
eol_hack.js - Don Cross
Fixes line endings in a text file to be CR LF pairs.
This is a hack so that there is no diff noise
caused by running jsdoc2md from Windows.
See open bug at:
https://github.com/jsdoc2md/jsdoc-to-markdown/issues/112
*/
'use strict';
const fs = require('fs');
function FixFile(filename) {
const inText = fs.readFileSync(filename, 'utf8');
const outText = inText.replace(/\r?\n|\r\n?/g, '\r\n');
if (inText === outText) {
console.log(`eol_hack.js: Leaving file as-is: ${filename}`);
} else {
fs.writeFileSync(filename, outText, 'utf8');
console.log(`eol_hack.js: Rewrote line endings: ${filename}`);
}
}
if (process.argv.length !== 3) {
console.log('USAGE: eol_hack.js filename');
process.exit(1);
}
FixFile(process.argv[2]);
process.exit(0);