You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
494 B
20 lines
494 B
# -*- mode: shell-script -*-
|
|
|
|
|
|
yaml_opt_flatten() {
|
|
local prefix="$1" key value
|
|
while read-0 key value; do
|
|
if [ "$prefix" ]; then
|
|
new_prefix="${prefix}-${key}"
|
|
else
|
|
new_prefix="${key}"
|
|
fi
|
|
if [[ "$(echo "$value" | shyaml get-type)" == "struct" ]]; then
|
|
echo "$value" | yaml_opt_flatten "${new_prefix}"
|
|
else
|
|
printf "%s\0%s\0" "${new_prefix}" "$value"
|
|
fi
|
|
done < <(shyaml key-values-0)
|
|
}
|
|
|
|
|