wb-cache 0.1.0

Your L1 in-app write-behind cache for various kinds of backends.
Documentation
fn <scope> ask_user
    question = set ${1}
    print -bgc red -c black " ► "
    print -bgc black -c white " ${question} "
    print -s bold "(y/N)"
    echo " "
    reply = read
    return ${reply}
end

fn <scope> require_vars
    vars = array %{1}
    missing = set false
    for v in ${vars}
        env_val = get_env ${v}
        if is_empty ${env_val}
            print -c bright_red "***ERROR***"
            println " Missing ${v} variable."
            missing = set true
        end
    end

    if ${missing}
        assert_fail "Consider adding missing variables in the main [env] section."
    end
end

# Function to generate the power set of an array
fn <scope> generate_power_set
    input = set ${1}
    len = arrlen ${input}
    indicies = range 0 ${len}
    sets = array
    power_set = array

    for i in ${indicies}
        elem = array_get ${input} ${i}
        elem = array ${elem}
        new_power_set = array
        for ps_elem in ${power_set}
            array_push ${new_power_set} ${ps_elem}
        end
        array_push ${new_power_set} ${elem}
        for ps_elem in ${power_set}
            new_elem = array_concat ${ps_elem} ${elem}
            array_push ${new_power_set} ${new_elem}
        end
        release ${power_set}
        power_set = set ${new_power_set}
    end
    return ${power_set}
end