Skip to content

Instantly share code, notes, and snippets.

@aristotle9
Forked from MadratJerry/find-rls-preview.sh
Last active August 18, 2020 08:11
Show Gist options
  • Save aristotle9/8071356bd1577c520559e6ca2f0845bc to your computer and use it in GitHub Desktop.
Save aristotle9/8071356bd1577c520559e6ca2f0845bc to your computer and use it in GitHub Desktop.
Find the latest rust nightly version with rls-preview
#!/bin/bash
MAC=false
date -r "$now" +%Y-%m-%d &> /dev/null
if [ "$?" -ne "0" ]; then echo "LINUX"; MAC=false; else echo 'MAC'; MAC=true; fi
now=`date +%s`
while true
do
if [ "$MAC" == "true" ]; then data=`date -r "$now" +%Y-%m-%d`; else data=`date -d @"$now" +%Y-%m-%d`; fi
echo $data
str=`curl -s https://static.rust-lang.org/dist/$data/channel-rust-nightly.toml` | grep -A 1 rls-preview.target.x86_64-apple-darwin | grep "available = true"
if [ "$str" != "" ]; then echo "Bingo!"; break; fi
now=$(($now-86400))
done
# use proxy for rustup: RUSTUP_USE_CURL=1 HTTPS_PROXY=socks5://127.0.0.1:1080 rustup ...
# when in wsl1, add export RUSTUP_IO_THREADS=1
# lookup available rls version in https://rust-lang.github.io/rustup-components-history/
# rustup toolchain add nightly-2019-09-05
# rustup default nightly-2019-09-25
# rustup component add rls rust-src rust-analysis rust-analyzer-preview rustfmt
# update rust-client.channel in vscode settings.json to newly installed toolchain: { "rust-client.channel": "nightly-2019-09-25" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment