mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-10-10 04:03:04 +08:00
Fix yq-incompatible subscription rename (#321)
mikefarah/yq does not support jq-style if/then/else expressions, so every subscription rename failed during expression parsing. Use with(select(...)) for the conditional active-source update and cover active and non-active renames with a real yq regression check.
This commit is contained in:
@@ -2611,7 +2611,7 @@ rename_subscription() {
|
||||
OLD_NAME="$old_name" NEW_NAME="$new_name" "$(yq_bin)" eval -i '
|
||||
.sources[env(NEW_NAME)] = .sources[env(OLD_NAME)] |
|
||||
del(.sources[env(OLD_NAME)]) |
|
||||
.active = (if .active == env(OLD_NAME) then env(NEW_NAME) else .active end)
|
||||
with(select(.active == env(OLD_NAME)); .active = env(NEW_NAME))
|
||||
' "$file"
|
||||
|
||||
old_prefix="$(health_key_prefix "$old_name")"
|
||||
|
||||
Reference in New Issue
Block a user