mapcomplete/scripts/mergeJsonFiles.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
598 B
TypeScript
Raw Normal View History

2022-09-08 21:40:48 +02:00
import { readFileSync, writeFileSync } from "fs"
import { Utils } from "../Utils"
2022-07-27 09:47:10 +02:00
function main(args: string[]) {
console.log("File Merge")
if (args.length != 3) {
console.log("Usage: input1.json input2.json output.json")
console.log("You passed in the arguments: " + args.join(","))
return
}
const [input1, input2, output] = args
const f1 = JSON.parse(readFileSync(input1, "utf8"))
const f2 = JSON.parse(readFileSync(input2, "utf8"))
Utils.Merge(f1, f2)
writeFileSync(output, JSON.stringify(f2, null, " "))
}
2022-09-08 21:40:48 +02:00
main(process.argv.slice(2))