This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
65 lines (57 loc) · 1.64 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env node
var fs = require('fs');
const args = process.argv.slice(2)
var exec = require('child_process').exec, child;
var path = args['path']
if (path == null) {
path = "./Log.txt"
}
var output = fs.createWriteStream(path + ".min");
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream(path)
});
var tableOfIgnores = [
'XSB:',
'XSB WARNING: ',
' ',
"Custom Scenery",
"Found an illegal name",
"We found a duplicate runway",
"in sign",
"Could not find tile ",
"Resources/default scenery",
"GroundTraffic:",
"Xchecklist",
"Terrain radar plugin",
"Airport-Navigator",
"FlyWithLua: Loaded sound file"
]
var outputTable = []
lineReader.on('line', function (line) {
for (i = 0; i < tableOfIgnores.length; i++) {
let act = true
if (line.match(tableOfIgnores[i])) {
// console.log("invalid line: " + i)
break
} else if (line === "") { break }
if (i === tableOfIgnores.length - 1) {
outputTable.push(line)
}
}
});
lineReader.on('error', function (err) { console.log(err) });
lineReader.on("close", function () {
output.on('error', function (err) { console.log(err) });
outputTable.forEach(function (v) { output.write(v + '\n'); });
output.end();
console.log("Done")
exec('code ' + path + ".min",
function (error, stdout, stderr) {
if (error !== null) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
console.log('exec error: ' + error);
}
});
}
)