From e32936662bbf75864cfce66227e944d7112f1ed1 Mon Sep 17 00:00:00 2001 From: robojerk Date: Wed, 25 Jun 2025 16:11:06 -0700 Subject: [PATCH] Fix TOML parser stack counter logic --- config-parser.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config-parser.sh b/config-parser.sh index 8068fae..7a8e548 100644 --- a/config-parser.sh +++ b/config-parser.sh @@ -36,6 +36,11 @@ parse_toml() { # Parse section headers [section] if [[ "$line" =~ ^[[:space:]]*\[([^\]]+)\][[:space:]]*$ ]]; then current_section="${BASH_REMATCH[1]}" + # Only increment stack_count for non-global sections + if [[ "$current_section" != "global" ]]; then + stack_count=$((stack_count + 1)) + STACK_NAMES[$stack_count]="$current_section" + fi continue fi @@ -60,9 +65,7 @@ parse_toml() { # Global settings export "${key^^}"="$value" else - # Stack configurations - stack_count=$((stack_count + 1)) - STACK_NAMES[$stack_count]="$current_section" + # Stack configurations - use current stack_count export "STACK_${stack_count}_${key^^}"="$value" fi fi