Fix TOML parser stack counter logic

This commit is contained in:
robojerk 2025-06-25 16:11:06 -07:00
parent 3c3e280c9d
commit e32936662b

View file

@ -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