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]
|
# Parse section headers [section]
|
||||||
if [[ "$line" =~ ^[[:space:]]*\[([^\]]+)\][[:space:]]*$ ]]; then
|
if [[ "$line" =~ ^[[:space:]]*\[([^\]]+)\][[:space:]]*$ ]]; then
|
||||||
current_section="${BASH_REMATCH[1]}"
|
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
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -60,9 +65,7 @@ parse_toml() {
|
||||||
# Global settings
|
# Global settings
|
||||||
export "${key^^}"="$value"
|
export "${key^^}"="$value"
|
||||||
else
|
else
|
||||||
# Stack configurations
|
# Stack configurations - use current stack_count
|
||||||
stack_count=$((stack_count + 1))
|
|
||||||
STACK_NAMES[$stack_count]="$current_section"
|
|
||||||
export "STACK_${stack_count}_${key^^}"="$value"
|
export "STACK_${stack_count}_${key^^}"="$value"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue