feat(selection): persist validated update preferences atomically

This commit is contained in:
fraujulian committed 2026-09-16 19:18:24 +02:00
1 parent 50cb82074e
commit 3a5790e67c
3 files changed
+115

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
read_update_selection() {
local saved key value
saved=$(python3 "$root/scripts/lib/selection-state.py" read --home "$home_path" --manifest "$root/adapters/plugins.tsv" --format tsv) || return
selected_plugins=()
deselected_plugins=()
while IFS=$'\t' read -r key value; do
value=${value%$'\r'}
case "$key" in
platform) [ -n "$platform" ] || platform=$value ;;
client) [ -n "$client" ] || client=$value ;;
selected) selected_plugins+=("$value") ;;
deselected) deselected_plugins+=("$value") ;;
esac
done <<< "$saved"
}
save_update_selection() {
python3 "$root/scripts/lib/selection-state.py" write --home "$home_path" --manifest "$root/adapters/plugins.tsv" \
--platform "$platform" --client "$client" --selected "${selected_plugins[@]}" --deselected "${deselected_plugins[@]}"
}