From 76fd99dd2b62268457e887275ae0f36b93a529a7 Mon Sep 17 00:00:00 2001 From: Noah Masur Date: Sat, 10 Apr 2021 13:15:14 -0400 Subject: [PATCH] rust-analyzer automation --- scripts/install_rust | 17 +++++++++-------- scripts/update_rust_analyzer | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100755 scripts/update_rust_analyzer diff --git a/scripts/install_rust b/scripts/install_rust index 3c7ff1e..1a30f43 100755 --- a/scripts/install_rust +++ b/scripts/install_rust @@ -30,15 +30,16 @@ download_rust_analyzer() { } install_cargos() { - programs=( - cargo-edit - cargo-whatfeatures - jql - toml-cli - ) - for i in "${programs[@]}"; do - cargo install "$i" + set -- \ + 'cargo-edit' + 'cargo-whatfeatures' \ + 'jql' \ + 'toml-cli' + for program do + cargo install "$program" done + + echo "cargos ✓" } install_rust diff --git a/scripts/update_rust_analyzer b/scripts/update_rust_analyzer new file mode 100755 index 0000000..11db745 --- /dev/null +++ b/scripts/update_rust_analyzer @@ -0,0 +1,19 @@ +#!/bin/sh + +update_rust_analyzer() { + if ! (which rust-analyzer > /dev/null) + then + echo "not installed" + else + echo "removing" + rm /usr/local/bin/rust-analyzer + fi + echo "downloading rust analyzer" + rust_analyzer_bin=/usr/local/bin/rust-analyzer + curl -s -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-mac -o $rust_analyzer_bin + chmod +x $rust_analyzer_bin + + echo "rust-analyzer ✓" +} + +update_rust_analyzer