Skip to content

Instantly share code, notes, and snippets.

@lizhuoqi
Created October 16, 2021 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizhuoqi/c43acc8038fca06c40db1e8c64fe761a to your computer and use it in GitHub Desktop.
Save lizhuoqi/c43acc8038fca06c40db1e8c64fe761a to your computer and use it in GitHub Desktop.
shell for downloading jetbrains installer | jetbrains ide 下载脚本
#!/bin/bash
products="goland|pycharm|webstorm|idea|appcode|rider|clion"
_app=$1
_ver=$2
[[ "$(echo $_app | tr '[:upper:]' '[:lower:]')" =~ ^($products)$ ]] || {
echo "Invalid. Only one of (goland, pycharm, webstorm, idea, appcode, rider, clion)." ;
echo "usage: jetbrains.sh pycharm 2021.2.2 or jetbrains.sh pycharm"
exit 1 ;
}
# idea
# https://data.services.jetbrains.com/products/download?code=IU&platform=mac
# redirect -> e.g. https://download.jetbrains.com.cn/idea/ideaIU-2021.2.2.dmg
# webstorm
# https://data.services.jetbrains.com/products/download?code=WS&platform=mac
# redirect -> e.g. https://download.jetbrains.com/webstorm/WebStorm-2021.2.2.dmg
# pycharm
# https://data.services.jetbrains.com/products/download?code=PCP&platform=mac
# redirect -> e.g. https://download.jetbrains.com/python/pycharm-professional-2021.2.2.dmg
# goland
# https://data.services.jetbrains.com/products/download?code=GO&platform=mac
# redirect -> e.g. https://download.jetbrains.com.cn/go/goland-2021.2.3.dmg
# appcode
# https://data.services.jetbrains.com/products/download?code=ac&platform=mac
# redirect -> e.g. https://download.jetbrains.com/objc/AppCode-2021.2.2.dmg
# clion
# https://data.services.jetbrains.com/products/download?code=CL&platform=mac
# redirect -> e.g. https://download.jetbrains.com/cpp/CLion-2021.2.1.dmg
# rider
# https://data.services.jetbrains.com/products/download?code=RD&platform=mac
# redirect -> e.g. https://download.jetbrains.com/rider/JetBrains.Rider-2021.2.1.dmg
# platform
# * windows: exe
# * windowsZip: zip
# * mac: dmg
# * macM1: -aarch64.dmg
# * linux: tar.gz
#
_product="$_app"
_os=`uname`
_plat="mac"
_type=""
# 通过https://data.services.jetbrains.com/products/download?code=XX&platform=mac
# 下载最新版本
[[ -z "$_ver" ]] && {
# echo "version#, like 2021.2.2"; exit 1;
echo "get the lastest version of $_product"
case "$_product" in
"idea" )
_product="IU" ;;
"goland" )
_product="GO" ;;
"pycharm" )
_product="PCP" ;;
"webstorm" )
_product="WS" ;;
"appcode" )
_product="ac" ;;
"rider" )
_product="rd" ;;
"clion" )
_product="cl" ;;
esac
case $_os in
"Darwin" ) _plat="mac" ;;
"Linux" ) _plat="linux" ;;
# windows 这个有问题
"windows" ) _plat="windows" ;;
* ) _plat="windows" ;;
esac
_url="https://data.services.jetbrains.com/products/download?code=$_product&platform=$_plat"
wget --content-disposition "$_url"
} || {
# 下载指定版本
# e.g. https://download.jetbrains.com.cn/idea/ideaIU-2021.2.2.dmg
case "$_product" in
"idea" )
_product="idea/ideaIU" ;;
"goland" )
_product="go/goland" ;;
"pycharm" )
_product="python/pycharm-professional"
;;
"webstorm" )
_product="webstorm/WebStorm"
;;
"appcode" )
_product="objc/AppCode"
;;
"rider" )
_product="rider/JetBrains.Rider"
;;
"clion" )
_product="cpp/CLion"
;;
esac
case $_os in
"Darwin" )
_type="dmg" ;;
"Linux" )
_type="tar.gz" ;;
# windows 这个有问题
"windows" )
_type="exe" ;;
* )
_type="exe" ;
esac
_url="https://download.jetbrains.com.cn/$_product-$_ver.$_type"
wget "$_url"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment