dotfiles working
This commit is contained in:
parent
75e8f2db85
commit
02ac070c2e
1 changed files with 15 additions and 2 deletions
17
forge
17
forge
|
|
@ -102,8 +102,21 @@ parse_toml() {
|
||||||
|
|
||||||
# Parse key-value pairs for non-packages sections
|
# Parse key-value pairs for non-packages sections
|
||||||
if [[ "$section" != "packages" && "$line" =~ ^([^=]+)=(.+)$ ]]; then
|
if [[ "$section" != "packages" && "$line" =~ ^([^=]+)=(.+)$ ]]; then
|
||||||
local key="${BASH_REMATCH[1]// /}"
|
local key="${BASH_REMATCH[1]}"
|
||||||
local value="${BASH_REMATCH[2]// /}"
|
local value="${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
|
# Trim leading/trailing whitespace from key and value
|
||||||
|
key=$(echo "$key" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
||||||
|
value=$(echo "$value" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
||||||
|
|
||||||
|
# Remove quotes from quoted strings
|
||||||
|
if [[ "$key" =~ ^\"(.*)\"$ ]]; then
|
||||||
|
key="${BASH_REMATCH[1]}"
|
||||||
|
fi
|
||||||
|
if [[ "$value" =~ ^\"(.*)\"$ ]]; then
|
||||||
|
value="${BASH_REMATCH[1]}"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$section:$key=$value"
|
echo "$section:$key=$value"
|
||||||
# Parse package names (just keys without values in packages section)
|
# Parse package names (just keys without values in packages section)
|
||||||
elif [[ "$section" == "packages" && "$line" =~ ^([^=]+)$ ]]; then
|
elif [[ "$section" == "packages" && "$line" =~ ^([^=]+)$ ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue