2023-07-21 10:45:07 -04:00
|
|
|
#!/usr/bin/env bash
|
2022-08-09 09:21:59 -04:00
|
|
|
|
2022-10-06 16:18:18 -04:00
|
|
|
set -e
|
|
|
|
|
2022-09-04 11:39:57 -04:00
|
|
|
export VSCODE_QUALITY="stable"
|
|
|
|
|
2023-07-21 10:45:07 -04:00
|
|
|
while getopts ":i" opt; do
|
2022-09-04 11:39:57 -04:00
|
|
|
case "$opt" in
|
|
|
|
i)
|
|
|
|
export VSCODE_QUALITY="insider"
|
|
|
|
;;
|
2023-07-21 10:45:07 -04:00
|
|
|
*)
|
|
|
|
;;
|
2022-09-04 11:39:57 -04:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2023-07-21 10:45:07 -04: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 09:21:59 -04:00
|
|
|
# echo "url: ${URL}"
|
2023-07-21 10:45:07 -04:00
|
|
|
FILE="${URL##*/}"
|
2022-08-09 09:21:59 -04:00
|
|
|
# echo "file: ${FILE}"
|
2023-07-21 10:45:07 -04:00
|
|
|
DIRECTORY="${FILE%.zip}"
|
2022-08-09 09:21:59 -04:00
|
|
|
# echo "directory: ${DIRECTORY}"
|
|
|
|
|
|
|
|
if [[ ! -f "${FILE}" ]]; then
|
|
|
|
wget "${URL}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -d "${DIRECTORY}" ]]; then
|
|
|
|
unzip "${FILE}" -d "${DIRECTORY}"
|
|
|
|
fi
|
|
|
|
|
2023-07-21 10:45:07 -04:00
|
|
|
APIS=$( jq -r '.extensionEnabledApiProposals' "${DIRECTORY}/resources/app/product.json" )
|
2022-08-09 09:21:59 -04:00
|
|
|
|
2023-07-21 10:45:07 -04:00
|
|
|
APIS=$( echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}' )
|
2023-09-03 10:32:02 -04:00
|
|
|
APIS=$( echo "${APIS}" | jq '. += {"jeanp413.open-remote-wsl": ["resolvers", "contribRemoteHelp", "contribViewsRemote"]}' )
|
2022-12-02 16:22:58 -05:00
|
|
|
|
2023-07-21 10:45:07 -04:00
|
|
|
jsonTmp=$( jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json )
|
2023-08-03 18:22:50 -04:00
|
|
|
echo "${jsonTmp}" > product.json && unset jsonTmp
|