mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 08:23:12 +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 = "";
|
let allConfigElements = "";
|
||||||
for (let group of response.serialized_config.groups) {
|
for (let group of response.serialized_config.groups) {
|
||||||
for (let [name, value] of Object.entries(group.fields)) {
|
for (let [name, value] of Object.entries(group.fields)) {
|
||||||
if (typeof value === "string") {
|
|
||||||
value = `\"${value}\"`;
|
|
||||||
}
|
|
||||||
// put quotes around value if it's a string
|
// put quotes around value if it's a string
|
||||||
|
|
||||||
let desc = libConfig.MasterConfig.groups.get(group.name)._definitions.get(name).description;
|
let desc = libConfig.MasterConfig.groups.get(group.name)._definitions.get(name).description;
|
||||||
allConfigElements += `# ${desc}\n`;
|
allConfigElements += `# ${desc}\n`;
|
||||||
// split onto two lines for readability and es-lint
|
// split onto two lines for readability and es-lint
|
||||||
|
if (String(value) === "null") {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
allConfigElements += `${group.name}.${name} = ${value}\n\n`;
|
allConfigElements += `${group.name}.${name} = ${value}\n\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,21 +169,21 @@ masterConfigCommands.add(new libCommand.Command({
|
|||||||
if (index in filtered) {
|
if (index in filtered) {
|
||||||
filtered[index] = filtered[index].split("=");
|
filtered[index] = filtered[index].split("=");
|
||||||
// split on the = we added earlier
|
// split on the = we added earlier
|
||||||
filtered[index][1] = filtered[index][1].replace(/['"]+/g, "");
|
let part = "";
|
||||||
// remove quotes we added earlier
|
try {
|
||||||
let part = filtered[index][1].trim();
|
part = filtered[index][1].trim();
|
||||||
let finalIndex = filtered[index][0].trim();
|
} catch (err) {
|
||||||
if (part === "undefined") {
|
part = null;
|
||||||
} else if (part === "null") {
|
|
||||||
final[finalIndex] = "";
|
|
||||||
} else {
|
|
||||||
final[finalIndex] = part;
|
|
||||||
}
|
}
|
||||||
|
print(part, typeof part);
|
||||||
|
let finalIndex = filtered[index][0].trim();
|
||||||
|
final[finalIndex] = part;
|
||||||
// trim whitespace and put in final array for processing
|
// trim whitespace and put in final array for processing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let element in final) {
|
for (let element in final) {
|
||||||
if (element in final) {
|
if (element in final) {
|
||||||
|
print(element, final[element], typeof final[element]);
|
||||||
await libLink.messages.setMasterConfigField.send(control, {
|
await libLink.messages.setMasterConfigField.send(control, {
|
||||||
field: element,
|
field: element,
|
||||||
value: final[element],
|
value: final[element],
|
||||||
|
|||||||
Reference in new issue
Block a user