From 7ee09ac7907bfe3adc34394aa25312ad70d3be95 Mon Sep 17 00:00:00 2001 From: Zachary S Date: Wed, 7 Oct 2026 00:31:52 +0000 Subject: [PATCH 1/2] Fix CLI config editor field names --- packages/ctl/src/config_ops.ts | 2 +- test/ctl/config_ops.test.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/ctl/config_ops.test.js diff --git a/packages/ctl/src/config_ops.ts b/packages/ctl/src/config_ops.ts index bf0e8a4b..09299657 100644 --- a/packages/ctl/src/config_ops.ts +++ b/packages/ctl/src/config_ops.ts @@ -16,7 +16,7 @@ export async function configToKeyVal(data: string) { for (let index in filtered) { if (index in filtered) { let split = filtered[index].split("="); - let finalIndex = filtered[index][0].trim(); + let finalIndex = split[0].trim(); // split on the = we added earlier, giving us both value and key let part = ""; try { diff --git a/test/ctl/config_ops.test.js b/test/ctl/config_ops.test.js new file mode 100644 index 00000000..5d3921e1 --- /dev/null +++ b/test/ctl/config_ops.test.js @@ -0,0 +1,21 @@ +import assert from "node:assert/strict"; +import { configToKeyVal } from "@clusterio/ctl/dist/node/src/config_ops.js"; + +describe("ctl/config_ops", function() { + it("preserves full field names with LF and CRLF input", async function() { + for (let newline of ["\n", "\r\n"]) { + const data = [ + "# Clusterio configuration", + "", + "instance.name = Example", + "inventory_sync.load_plugin = false", + "", + ].join(newline); + + assert.deepEqual(await configToKeyVal(data), { + "instance.name": "Example", + "inventory_sync.load_plugin": "false", + }); + } + }); +}); From c11079260d27ebff986fde3b10ed2c46ea128c60 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Wed, 7 Oct 2026 19:52:16 +0100 Subject: [PATCH 2/2] Fix copy paste error in error message --- packages/ctl/src/commands_host.ts | 2 +- packages/ctl/src/commands_instance.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ctl/src/commands_host.ts b/packages/ctl/src/commands_host.ts index 1f343181..77ab6936 100644 --- a/packages/ctl/src/commands_host.ts +++ b/packages/ctl/src/commands_host.ts @@ -219,7 +219,7 @@ hostConfigCommands.add(new lib.Command({ let editor = await getEditor(args.editor); if (editor === undefined) { throw new lib.CommandError(`No editor avalible. Checked CLI input, EDITOR and VISUAL env vars - Try "ctl controller config edit "`); + Try "ctl host config edit "`); } let disallowedList = {"host.id": 0}; let allConfigElements = serializedConfigToString( diff --git a/packages/ctl/src/commands_instance.ts b/packages/ctl/src/commands_instance.ts index 6a1f79ad..bedd78eb 100644 --- a/packages/ctl/src/commands_instance.ts +++ b/packages/ctl/src/commands_instance.ts @@ -156,7 +156,7 @@ instanceConfigCommands.add(new lib.Command({ let editor = await getEditor(args.editor); if (editor === undefined) { throw new lib.CommandError(`No editor avalible. Checked CLI input, EDITOR and VISUAL env vars - Try "ctl controller config edit "`); + Try "ctl instance config edit "`); } let disallowedList = {"instance.id": 0, "instance.assigned_host": 0, "factorio.settings": 0}; let allConfigElements = serializedConfigToString(