1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/loki_ynh.git synced 2024-09-03 19:36:16 +02:00
loki_ynh/sources/extra_files/loki/merge_yaml.sh

14 lines
355 B
Bash

#!/bin/bash
shopt -s nullglob
file_list=($@)
{
for file in "${file_list[@]}"
do
/usr/bin/python3 -c "import yaml, json; print(json.dumps(yaml.safe_load(open('$file')), default=str))"
done
} \
| /usr/bin/jq --slurp 'reduce .[] as $item ({}; . * $item)' \
| /usr/bin/python3 -c "import yaml, json; print(yaml.dump(json.load(open('/dev/stdin'))))"