From f411368e80c72fd2fee36cf8bec650ec2fbdcaf8 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 8 Mar 2024 13:03:06 +0000 Subject: [PATCH] Adjust merge-yaml script to output owlboard style yaml --- scripts/merge-yaml.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/merge-yaml.js b/scripts/merge-yaml.js index 1940d01..1404e6b 100644 --- a/scripts/merge-yaml.js +++ b/scripts/merge-yaml.js @@ -32,10 +32,23 @@ function sortAndMergeYAMLFiles() { }) const mergedYaml = yaml.stringify(mergedData); - console.log(mergedYaml) + + // Construct the output string + let outputString = "pis:\n"; + mergedData.forEach(item => { + outputString += ` - code: "${item.code}"\n`; + outputString += ` stops: [${item.stops.map(stop => `"${stop}"`).join(', ')}]\n`; + }); + + console.log(outputString) } catch(err) { console.error('Error merging YAML:', err) } } +function yamlWriteInNiceFormat(yaml) { + output = "pis:\n" + +} + sortAndMergeYAMLFiles(); \ No newline at end of file