Fix TOML parser stack counter logic
This commit is contained in:
parent
3c3e280c9d
commit
e32936662b
1 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue