2023-07-21 17:45:07 +03:00
|
|
|
#!/usr/bin/env bash
|
2022-08-09 16:21:59 +03:00
|
|
|
|
2022-10-06 23:18:18 +03:00
|
|
|
set -e
|
|
|
|
|
2022-09-04 18:39:57 +03:00
|
|
|
export VSCODE_QUALITY="stable"
|
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
while getopts ":i" opt; do
|
2022-09-04 18:39:57 +03:00
|
|
|
case "$opt" in
|
|
|
|
i)
|
|
|
|
export VSCODE_QUALITY="insider"
|
|
|
|
;;
|
2023-07-21 17:45:07 +03:00
|
|
|
*)
|
|
|
|
;;
|
2022-09-04 18:39:57 +03:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
URL=$( curl -s "https://update.code.visualstudio.com/api/update/win32-x64-archive/${VSCODE_QUALITY}/0000000000000000000000000000000000000000" | jq -c '.url' | sed -E 's/.*"([^"]+)".*/\1/' )
|
2022-08-09 16:21:59 +03:00
|
|
|
# echo "url: ${URL}"
|
2023-07-21 17:45:07 +03:00
|
|
|
FILE="${URL##*/}"
|
2022-08-09 16:21:59 +03:00
|
|
|
# echo "file: ${FILE}"
|
2023-07-21 17:45:07 +03:00
|
|
|
DIRECTORY="${FILE%.zip}"
|
2022-08-09 16:21:59 +03:00
|
|
|
# echo "directory: ${DIRECTORY}"
|
|
|
|
|
|
|
|
if [[ ! -f "${FILE}" ]]; then
|
|
|
|
wget "${URL}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -d "${DIRECTORY}" ]]; then
|
|
|
|
unzip "${FILE}" -d "${DIRECTORY}"
|
|
|
|
fi
|
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
APIS=$( jq -r '.extensionEnabledApiProposals' "${DIRECTORY}/resources/app/product.json" )
|
2022-08-09 16:21:59 +03:00
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
APIS=$( echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}' )
|
2022-12-03 00:22:58 +03:00
|
|
|
|
2023-07-21 17:45:07 +03:00
|
|
|
jsonTmp=$( jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json )
|
2023-08-04 01:22:50 +03:00
|
|
|
echo "${jsonTmp}" > product.json && unset jsonTmp
|