mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Fix CLI config editor field names
This commit is contained in:
1 parent
b07c25aa7e
commit
7ee09ac790
2 files changed
+22
-1
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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",
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user