mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Fix styling to be more consistant with the rest of clustorio
This commit is contained in:
1 parent
4612826664
commit
76882ad1c4
1 file changed
+12
-14
+12
-14
@@ -133,15 +133,13 @@ masterConfigCommands.add(new libCommand.Command({
|
||||
let allConfigElements = "";
|
||||
for (let group of response.serialized_config.groups) {
|
||||
for (let [name, value] of Object.entries(group.fields)) {
|
||||
if (typeof value === "string") {
|
||||
value = `\"${value}\"`;
|
||||
}
|
||||
// put quotes around value if it's a string
|
||||
|
||||
let desc = libConfig.MasterConfig.groups.get(group.name)._definitions.get(name).description;
|
||||
allConfigElements += `# ${desc}\n`;
|
||||
// split onto two lines for readability and es-lint
|
||||
|
||||
if (String(value) === "null") {
|
||||
value = "";
|
||||
}
|
||||
allConfigElements += `${group.name}.${name} = ${value}\n\n`;
|
||||
}
|
||||
}
|
||||
@@ -171,21 +169,21 @@ masterConfigCommands.add(new libCommand.Command({
|
||||
if (index in filtered) {
|
||||
filtered[index] = filtered[index].split("=");
|
||||
// split on the = we added earlier
|
||||
filtered[index][1] = filtered[index][1].replace(/['"]+/g, "");
|
||||
// remove quotes we added earlier
|
||||
let part = filtered[index][1].trim();
|
||||
let finalIndex = filtered[index][0].trim();
|
||||
if (part === "undefined") {
|
||||
} else if (part === "null") {
|
||||
final[finalIndex] = "";
|
||||
} else {
|
||||
final[finalIndex] = part;
|
||||
let part = "";
|
||||
try {
|
||||
part = filtered[index][1].trim();
|
||||
} catch (err) {
|
||||
part = null;
|
||||
}
|
||||
print(part, typeof part);
|
||||
let finalIndex = filtered[index][0].trim();
|
||||
final[finalIndex] = part;
|
||||
// trim whitespace and put in final array for processing
|
||||
}
|
||||
}
|
||||
for (let element in final) {
|
||||
if (element in final) {
|
||||
print(element, final[element], typeof final[element]);
|
||||
await libLink.messages.setMasterConfigField.send(control, {
|
||||
field: element,
|
||||
value: final[element],
|
||||
|
||||
Reference in new issue
Block a user