aboutsummaryrefslogtreecommitdiff
# Copyright (C) 2021 Wojtek Kosior
# Redistribution terms are gathered in the `copyright' file.

# This file is meant to be sourced in sh.

ENDL="
"

errcho() {
    echo "$@" >&2
}

map_set_instr() {
    echo "$1__$2='$3'"
}

map_set() {
    eval "$(map_set_instr "$@")"
}

map_set_export() {
    eval "export $(map_set_instr "$@")"
}

map_get() {
    eval "echo \"\$$1__$2\""
}

map_del_instr() {
    echo "unset $1__$2"
}

map_del() {
    eval "$(map_del_instr "$@")"
}

sanitize() {
    echo "$1" | tr /.- _
}