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.

25 lines
708 B

  1. yaml_opt_bash_env() {
  2. local prefix="$1" key value
  3. while read-0 key value; do
  4. new_prefix="${prefix}_${key^^}"
  5. if [[ "$(echo "$value" | shyaml get-type)" == "struct" ]]; then
  6. echo "$value" | yaml_opt_bash_env "${new_prefix}"
  7. else
  8. printf "%s\0%s\0" "${new_prefix/-/_}" "$value"
  9. fi
  10. done < <(shyaml key-values-0)
  11. }
  12. yaml_opt_bash_env_ignore_first_level() {
  13. local prefix="$1" key value
  14. while read-0 key value; do
  15. new_prefix="${prefix}_${key^^}"
  16. if [[ "$(echo "$value" | shyaml get-type)" == "struct" ]]; then
  17. echo "$value" | yaml_opt_bash_env "${new_prefix}"
  18. fi
  19. done < <(shyaml key-values-0)
  20. }