From da1cd3215820b762e0108cb96989537aed224cb2 Mon Sep 17 00:00:00 2001 From: Harkaran Brar Date: Mon, 6 Apr 2026 14:06:46 -0700 Subject: [PATCH] Fix shellcheck warning toggle script updates Co-Authored-By: Oz --- package-lock.json | 4 ++-- scripts/toggle.sh | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index d94510b..9745c11 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@isupervillain/opencode-container-exec", - "version": "1.0.0-beta.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@isupervillain/opencode-container-exec", - "version": "1.0.0-beta.0", + "version": "1.0.1", "cpu": [ "x64", "arm64" diff --git a/scripts/toggle.sh b/scripts/toggle.sh index 10b43f8..55cbdb2 100755 --- a/scripts/toggle.sh +++ b/scripts/toggle.sh @@ -325,8 +325,19 @@ select_container() { local id while IFS= read -r id; do - if [[ -n "$id" ]] && [[ ! " ${auto_containers[*]} " =~ " ${id} " ]]; then - auto_containers+=("$id") + if [[ -n "$id" ]]; then + local is_duplicate=false + local existing_id + for existing_id in "${auto_containers[@]}"; do + if [[ "$existing_id" == "$id" ]]; then + is_duplicate=true + break + fi + done + + if [[ "$is_duplicate" == false ]]; then + auto_containers+=("$id") + fi fi done <<< "$auto_container_lines" done < <(get_auto_detect_paths "$win_path")