mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Reworked to use config list's grabber system
Also now using the system described by Hornwitser, in using libConfig.MasterConfig.groups to get definitions. Now all that's needed is to re-read the updated data back into clustorio.
This commit is contained in:
1 parent
08a8182173
commit
92814aa9b3
1 file changed
+16
-10
+16
-10
@@ -126,20 +126,26 @@ masterConfigCommands.add(new libCommand.Command({
|
|||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
// needed for the process.env statements to not be flagged by eslint
|
// needed for the process.env statements to not be flagged by eslint
|
||||||
} else {
|
} else {
|
||||||
print();
|
|
||||||
throw new libErrors.CommandError("No editor avalible. Checked CLI input, EDITOR and VISUAL env vars");
|
throw new libErrors.CommandError("No editor avalible. Checked CLI input, EDITOR and VISUAL env vars");
|
||||||
}
|
}
|
||||||
|
let allConfigElements = "";
|
||||||
async function afterEditorDone() {
|
for (let group of response.serialized_config.groups) {
|
||||||
let MainConfig = new libConfig.MasterConfig("exampleonetwothree123");
|
for (let [name, value] of Object.entries(group.fields)) {
|
||||||
await MainConfig.load(response.serialized_config, "exampleonetwothree123");
|
// needed for line lenght; IMO this is more readable then using a temp var
|
||||||
let groups = Array.from(libConfig.MasterConfig.groups.keys());
|
// eslint-disable-next-line
|
||||||
// convert from MapIterator to array
|
allConfigElements += `# ${libConfig.MasterConfig.groups.get(group.name)._definitions.get(name).description}\n`;
|
||||||
let mainConfigGroups = [];
|
allConfigElements += `${group.name}.${name} ${JSON.stringify(value)}\n\n`;
|
||||||
for (let i = 0; i < groups.length; i++) {
|
|
||||||
mainConfigGroups[i] = MainConfig.group(groups[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print(allConfigElements);
|
||||||
|
fs.writeFile(tmpFile, allConfigElements, (err) => {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
print(allConfigElements);
|
||||||
|
async function afterEditorDone() {
|
||||||
|
}
|
||||||
|
|
||||||
// <-- start process of running editor -->
|
// <-- start process of running editor -->
|
||||||
let editorSpawn = child_process.spawn(editor, [tmpFile], {
|
let editorSpawn = child_process.spawn(editor, [tmpFile], {
|
||||||
|
|||||||
Reference in new issue
Block a user