-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcli.sh
67 lines (57 loc) · 1.4 KB
/
cli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
install_python_packages() {
local pip_packages=(
black
xkcdpass
)
for p in "${pip_packages[@]}"; do
if pip3 show "$p" >/dev/null; then
warn "Package $p is already installed"
else
info "Installing package < $p >"
pip3 install "$p"
fi
done
}
install_go_tools() {
declare -A tools=(
[delve]="github.com/go-delve/delve/cmd/dlv@latest"
[shfmt]="mvdan.cc/sh/v3/cmd/shfmt@latest"
[moq]="github.com/matryer/moq@latest"
[gofumpt]="mvdan.cc/gofumpt@latest"
)
for tool in "!${tools[@]}"; do
if ! command -v "$tool" &>/dev/null; then
info "Installing go tool < $tool >"
go install "${tools[$tool]}"
else
warn "$tool is already installed"
fi
done
}
install_rust_tools() {
source "$HOME/.cargo/env"
if ! command -v rust-analyzer &>/dev/null; then
info "Installing rust-analyzer"
brew install rust-analyzer
fi
if ! cargo audit --version &>/dev/null; then
info "Installing cargo-audit"
cargo install cargo-audit --features=fix
fi
if ! cargo edit --version &>/dev/null; then
info "Installing cargo-edit"
cargo install cargo-edit
fi
if ! cargo nextest --version &>/dev/null; then
info "Installing cargo-nextest"
cargo install cargo-nextest
fi
if ! cargo fmt --version &>/dev/null; then
info "Installing rustfmt"
rustup component add rustfmt
fi
if ! cargo clippy --version &>/dev/null; then
info "Installing clippy"
rustup component add clippy
fi
}