update_api.sh 1002 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. set -e
  3. export VSCODE_QUALITY="stable"
  4. while getopts ":ilp" opt; do
  5. case "$opt" in
  6. i)
  7. export VSCODE_QUALITY="insider"
  8. ;;
  9. esac
  10. done
  11. URL=`curl -s "https://update.code.visualstudio.com/api/update/win32-x64-archive/${VSCODE_QUALITY}/VERSION" | jq -c '.url' | sed -E 's/.*"([^"]+)".*/\1/'`
  12. # echo "url: ${URL}"
  13. FILE=`echo "${URL}" | sed -E 's|.*/([^/]+\.zip)$|\1|'`
  14. # echo "file: ${FILE}"
  15. DIRECTORY=`echo "${URL}" | sed -E 's|.*/([^/]+)\.zip$|\1|'`
  16. # echo "directory: ${DIRECTORY}"
  17. if [[ ! -f "${FILE}" ]]; then
  18. wget "${URL}"
  19. fi
  20. if [[ ! -d "${DIRECTORY}" ]]; then
  21. unzip "${FILE}" -d "${DIRECTORY}"
  22. fi
  23. APIS=`cat ${DIRECTORY}/resources/app/product.json | jq -r '.extensionEnabledApiProposals'`
  24. APIS=`echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}'`
  25. cat <<< $(jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json) > product.json