fix toml_get_table

This commit is contained in:
j-hc 2023-10-01 00:38:32 +03:00
parent c078cf5cbb
commit a05813de5a
No known key found for this signature in database
GPG Key ID: B69B8F690911EFCC

View File

@ -25,7 +25,7 @@ toml_get_table_names() {
fi
echo "$tn"
}
toml_get_table() { sed -n "/\[${1}]/,/^\[.*]$/p" <<<"$__TOML__" | sed '$ d'; }
toml_get_table() { sed -n "/\[${1}]/,/^\[.*]$/p" <<<"$__TOML__" | sed '/^\[/d'; }
toml_get() {
local table=$1 key=$2 val
val=$(grep -m 1 "^${key}=" <<<"$table") && sed -e "s/^\"//; s/\"$//" <<<"${val#*=}"