From 02ac070c2e410e41b33ed3b25a3605ac206f23a8 Mon Sep 17 00:00:00 2001 From: kumar vaibhav Date: Fri, 21 Nov 2025 20:58:37 +0530 Subject: [PATCH] dotfiles working --- forge | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/forge b/forge index 0120279..2b247e4 100755 --- a/forge +++ b/forge @@ -102,8 +102,21 @@ parse_toml() { # Parse key-value pairs for non-packages sections if [[ "$section" != "packages" && "$line" =~ ^([^=]+)=(.+)$ ]]; then - local key="${BASH_REMATCH[1]// /}" - local value="${BASH_REMATCH[2]// /}" + local key="${BASH_REMATCH[1]}" + 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" # Parse package names (just keys without values in packages section) elif [[ "$section" == "packages" && "$line" =~ ^([^=]+)$ ]]; then