Adjust merge-yaml script to output owlboard style yaml

This commit is contained in:
Fred Boniface 2024-03-08 13:03:06 +00:00
parent cf52b236cf
commit f411368e80

View File

@ -32,10 +32,23 @@ function sortAndMergeYAMLFiles() {
}) })
const mergedYaml = yaml.stringify(mergedData); 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) { } catch(err) {
console.error('Error merging YAML:', err) console.error('Error merging YAML:', err)
} }
} }
function yamlWriteInNiceFormat(yaml) {
output = "pis:\n"
}
sortAndMergeYAMLFiles(); sortAndMergeYAMLFiles();