summaryrefslogtreecommitdiff
path: root/.vscode
diff options
context:
space:
mode:
Diffstat (limited to '.vscode')
-rwxr-xr-x.vscode/build.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/.vscode/build.sh b/.vscode/build.sh
index 2310ff0..2c72e60 100755
--- a/.vscode/build.sh
+++ b/.vscode/build.sh
@@ -1,10 +1,26 @@
#!/usr/bin/env bash
-CLI_LOCATION="$(pwd)/cli"
-echo "Building plugin in $(pwd)"
-printf "Please input sudo password to proceed.\n"
-# read -s sudopass
+set -euo pipefail
-# printf "\n"
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &> /dev/null && pwd)"
+REPO_ROOT="$(cd -- "$SCRIPT_DIR/.." &> /dev/null && pwd)"
+LOCAL_CLI="$REPO_ROOT/cli/decky"
+SYSTEM_CLI="$(command -v decky || true)"
-echo $sudopass | sudo -E $CLI_LOCATION/decky plugin build $(pwd)
+if [[ -x "$LOCAL_CLI" ]]; then
+ CLI_LOCATION="$LOCAL_CLI"
+elif [[ -n "$SYSTEM_CLI" ]]; then
+ CLI_LOCATION="$SYSTEM_CLI"
+else
+ echo "Decky CLI not found. Run .vscode/setup.sh first or install the decky CLI manually."
+ exit 1
+fi
+
+echo "Building plugin in $REPO_ROOT"
+echo "Using Decky CLI: $CLI_LOCATION"
+
+if [[ "${DECKY_BUILD_USE_SUDO:-0}" == "1" ]]; then
+ sudo -E "$CLI_LOCATION" plugin build "$REPO_ROOT"
+else
+ "$CLI_LOCATION" plugin build "$REPO_ROOT"
+fi