update evaluation
This commit is contained in:
@@ -214,7 +214,8 @@ parse_rules() {
|
||||
[[ "$line" =~ ^# ]] && continue
|
||||
|
||||
case "$line" in
|
||||
if:)
|
||||
"- conditions:")
|
||||
# finalize previous rule
|
||||
finalize_rule "$current_conditions" "$current_variables"
|
||||
|
||||
current_conditions=""
|
||||
@@ -222,34 +223,35 @@ parse_rules() {
|
||||
mode="conditions"
|
||||
;;
|
||||
|
||||
set:)
|
||||
"set:")
|
||||
mode="variables"
|
||||
;;
|
||||
|
||||
*)
|
||||
case "$mode" in
|
||||
conditions)
|
||||
if [[ -n "$current_conditions" ]]; then
|
||||
current_conditions+=$'\n'
|
||||
fi
|
||||
current_conditions+="$line"
|
||||
;;
|
||||
-*)
|
||||
if [[ "$mode" == "conditions" ]]; then
|
||||
line="${line#- }"
|
||||
|
||||
variables)
|
||||
if [[ -n "$current_variables" ]]; then
|
||||
current_variables+=$'\n'
|
||||
fi
|
||||
current_variables+="$line"
|
||||
;;
|
||||
if [[ -n "$current_conditions" ]]; then
|
||||
current_conditions+=$'\n'
|
||||
fi
|
||||
|
||||
*)
|
||||
echo "Unexpected line outside of if:/set: block: $line"
|
||||
;;
|
||||
esac
|
||||
current_conditions+="$line"
|
||||
fi
|
||||
;;
|
||||
|
||||
*=*)
|
||||
if [[ "$mode" == "variables" ]]; then
|
||||
if [[ -n "$current_variables" ]]; then
|
||||
current_variables+=$'\n'
|
||||
fi
|
||||
|
||||
current_variables+="$line"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
done <<< "${RULES:-}"
|
||||
|
||||
# process last rule
|
||||
finalize_rule "$current_conditions" "$current_variables"
|
||||
}
|
||||
Reference in New Issue
Block a user