Remove uncoloured formatting of factorioOutput

Since chalk autodetects the color support in the terminal there is no
need for a non-coloured version of formatOutput.
This commit is contained in:
Hornwitser committed 2019-11-30 00:08:10 +01:00
1 parent c6fd46e3c3
commit ea4f3ab2bf
2 files changed
+1 -39

No files matched your search

+1 -31
View File
@@ -44,31 +44,6 @@ function formatOutputColored(output) {
return time + info + output.message;
}
/**
* Format a parsed Factorio output message
*
* Formats a parsed Factorio output from lib/factorio into a readable
* output string that can be printed
*/
function formatOutput(output) {
let time = "";
if (output.format === 'seconds') {
time = output.time.padStart(8) + ' ';
} else if (output.format === 'date') {
time = output.time + ' ';
}
let info = "";
if (output.type === 'log') {
info = output.level + ' ' + output.file + ': ';
} else if (output.type === 'action') {
info = '[' + output.action + '] ';
}
return time + info + output.message;
}
/**
* Represens a command that can be runned by clusterctl
*/
@@ -282,11 +257,7 @@ class Control extends link.Link {
async instanceOutputEventHandler(message) {
let { instance_id, output } = message.data;
if (process.platform === "win32") {
console.log(formatOutput(output));
} else {
console.log(formatOutputColored(output));
}
console.log(formatOutputColored(output));
}
}
@@ -435,7 +406,6 @@ async function startControl() {
module.exports = {
// for testing only
_formatOutputColored: formatOutputColored,
_formatOutput: formatOutput,
_resolveInstance: resolveInstance,
_Control: Control,
-8
View File
@@ -22,14 +22,6 @@ describe("clusterctl", function() {
chalk.level = old;
});
});
describe("formatOutput()", function() {
it("should pass the test lines", function() {
for (let [reference, output] of testLines) {
let line = clusterctl._formatOutput(output);
assert.deepEqual(line, reference);
}
});
});
let mockConnector = new mock.MockConnector();
mockConnector.on('send', function(message) {