#!/usr/bin/env bash

yaml::get() {
    local file="$1" query="$2"
    yq "$query" "$file"
}

yaml::getArray() {
    local file="$1" query="$2"
    yq -r "${query} | .[]" "$file" 2>/dev/null || true
}

yaml::has() {
    local file="$1" query="$2"
    local value
    value="$(yq "$query" "$file" 2>/dev/null)"
    [[ -n "$value" && "$value" != "null" ]]
}
