1
0
Fork 0

rust-manage.sh: improve pgrep and completion gen

This commit is contained in:
Pratham Patel 2024-01-27 22:46:35 +05:30
parent 2c0f553087
commit 6b60efabc4
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 13 additions and 6 deletions

View File

@ -7,17 +7,24 @@ if ! command -v rustup > /dev/null; then
exit 1
fi
if pgrep --exact "rust-analyzer|cargo|rustc" > /dev/null; then
>&2 echo 'You are probably using components that will be updated, even replaced...'
>&2 echo 'Not continuing'
exit 1
if [ "$(uname -s)" = 'Linux' ]; then
if pgrep --exact "rust-analyzer|cargo|rustc" > /dev/null; then
>&2 echo 'You are probably using components that will be updated, even replaced...'
>&2 echo 'Not continuing'
exit 1
fi
fi
rustup default stable
rustup update stable
rustup component add rust-src rust-analysis rust-analyzer clippy
if [ ! -d "${HOME}/.config/fish/completions" ]; then
if echo "${SHELL}" | grep 'bash' > /dev/null; then
mkdir -p "${HOME}/.local/share/bash-completion/completions"
rustup completions bash > "${HOME}/.local/share/bash-completion/completions/rustup"
rustup completions bash cargo > "${HOME}/.local/share/bash-completion/completions/cargo"
elif echo "${SHELL}" | grep 'fish' > /dev/null; then
mkdir -p "${HOME}/.config/fish/completions"
rustup completions fish > "${HOME}/.config/fish/completions/rustup.fish"
rustup completions fish cargo > "${HOME}/.config/fish/completions/cargo.fish"
fi
rustup completions fish > "${HOME}/.config/fish/completions/rustup.fish"