Feature: add multiTitle, better error handling, improve help text of script

This commit is contained in:
Pieter Vander Vennet 2025-09-02 23:08:28 +02:00
parent 1bdff87bbd
commit 0d33e18a59
7 changed files with 29 additions and 7 deletions

View file

@ -14,13 +14,20 @@ import { GenerateLicenseInfo } from "./generateLicenseInfo"
class ImportCustomTheme extends Script {
constructor() {
super("Given the path of a custom layer, will load the layer into mapcomplete as official")
super(["Given the path of a custom layer, will load the layer into mapcomplete as official","",
"Usage:",
"vite-node scripts/importCustomTheme.ts <path-of-layer-or-theme>"].join("\n"))
}
async main(args: string[]) {
if(args.length === 0){
this.printHelp()
return
}
const path = args[0]
const layerconfig = <LayerConfigJson>JSON.parse(readFileSync(path, "utf-8"))
const layerconfig = <LayerConfigJson>JSON.parse(
readFileSync(path, "utf-8"))
const id = layerconfig.id
const dirPath = "./assets/layers/" + id
if (!existsSync(dirPath)) {