vscodium/build/update_api.sh
2023-01-08 11:11:51 +01:00

36 lines
1,002 B
Bash
Executable file

#!/bin/bash
set -e
export VSCODE_QUALITY="stable"
while getopts ":ilp" opt; do
case "$opt" in
i)
export VSCODE_QUALITY="insider"
;;
esac
done
URL=`curl -s "https://update.code.visualstudio.com/api/update/win32-x64-archive/${VSCODE_QUALITY}/VERSION" | jq -c '.url' | sed -E 's/.*"([^"]+)".*/\1/'`
# echo "url: ${URL}"
FILE=`echo "${URL}" | sed -E 's|.*/([^/]+\.zip)$|\1|'`
# echo "file: ${FILE}"
DIRECTORY=`echo "${URL}" | sed -E 's|.*/([^/]+)\.zip$|\1|'`
# echo "directory: ${DIRECTORY}"
if [[ ! -f "${FILE}" ]]; then
wget "${URL}"
fi
if [[ ! -d "${DIRECTORY}" ]]; then
unzip "${FILE}" -d "${DIRECTORY}"
fi
APIS=`cat ${DIRECTORY}/resources/app/product.json | jq -r '.extensionEnabledApiProposals'`
APIS=`echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}'`
cat <<< $(jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json) > product.json