-
Notifications
You must be signed in to change notification settings - Fork 1k
/
update_api.sh
executable file
·39 lines (29 loc) · 1.12 KB
/
update_api.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -e
export VSCODE_QUALITY="stable"
while getopts ":i" 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}/0000000000000000000000000000000000000000" | jq -c '.url' | sed -E 's/.*"([^"]+)".*/\1/' )
# echo "url: ${URL}"
FILE="${URL##*/}"
# echo "file: ${FILE}"
DIRECTORY="${FILE%.zip}"
# echo "directory: ${DIRECTORY}"
if [[ ! -f "${FILE}" ]]; then
wget "${URL}"
fi
if [[ ! -d "${DIRECTORY}" ]]; then
unzip "${FILE}" -d "${DIRECTORY}"
fi
APIS=$( jq -r '.extensionEnabledApiProposals' "${DIRECTORY}/resources/app/product.json" )
APIS=$( echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}' )
APIS=$( echo "${APIS}" | jq '. += {"jeanp413.open-remote-wsl": ["resolvers", "contribRemoteHelp", "contribViewsRemote"]}' )
jsonTmp=$( jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json )
echo "${jsonTmp}" > product.json && unset jsonTmp