diff options
author | johannst <stoelp@eit.uni-kl.de> | 2019-05-19 01:08:33 +0200 |
---|---|---|
committer | johannst <stoelp@eit.uni-kl.de> | 2019-05-19 01:08:33 +0200 |
commit | f06a728ad607fcfe8b8fab235c58822f4f5b707c (patch) | |
tree | ef9b214f5b097e347545713bb579bb2fac23f11d /install_rust_tools | |
parent | 459d404fe70469cc68c0dcdfb3ae2d376ba95164 (diff) | |
download | dotfiles-f06a728ad607fcfe8b8fab235c58822f4f5b707c.tar.gz dotfiles-f06a728ad607fcfe8b8fab235c58822f4f5b707c.zip |
added rust tool installer
Diffstat (limited to 'install_rust_tools')
-rwxr-xr-x | install_rust_tools | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/install_rust_tools b/install_rust_tools new file mode 100755 index 0000000..856aeee --- /dev/null +++ b/install_rust_tools @@ -0,0 +1,26 @@ +#!/bin/bash + +if ! which cargo &> /dev/null; then + echo "There is no cargo installed, checkout:" + echo " https://rustup.rs/" + exit 1 +fi + +tools=() +tools+=("bat") +tools+=("exa") +tools+=("fd-find") +tools+=("ripgrep") + +for tool in ${tools[@]}; do + installed_vers=$(cargo install --list | grep "^$tool" | awk '{ print $2 }' | sed 's/[v:]//g') + [[ ! -z $installed_vers ]] && { + update_vers=$(cargo search --limit 1 $tool | awk 'NR==1 { print $3 }' | sed 's/"//g') + [[ $installed_vers == $update_vers ]] && { continue; } + echo ">>> update $tool $installed_vers -> $update_vers? [yYnN]" + read reply + [[ $reply =~ ^[^Yy]$ ]] && { continue; } + } + cargo install --force $tool +done + |