-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup-ripgrep
executable file
·52 lines (44 loc) · 939 Bytes
/
setup-ripgrep
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
#!/usr/bin/env bash
set -euo pipefail
command_exists() {
type "${1}" >/dev/null 2>&1
}
ensure_tool() {
local -r tool="${1}"
if ! type "${tool}" >/dev/null 2>&1; then
echo "missing required tool: ${tool}"
exit 1
fi
}
setup_for_darwin() {
ensure_tool brew
echo 'brew "ripgrep"' | brew bundle --no-lock --file=-
}
setup_for_debian() {
if test "$(uname -m)" = "aarch64"; then
export CARGO_HOME=${CARGO_HOME:-"${HOME}/.local/share/cargo"}
export RUSTUP_HOME=${RUSTUP_HOME:-"${HOME}/.local/share/rustup"}
export PATH="${PATH}:${CARGO_HOME}/bin"
source "${CARGO_HOME}/env"
cargo install ripgrep
else
setup-from-github-release "BurntSushi/ripgrep" "amd64.deb"
fi
}
setup_ripgrep() {
case $OSTYPE in
darwin*)
setup_for_darwin
;;
linux*)
if command_exists dpkg; then
setup_for_debian
fi
;;
*)
echo "Unknown OS!"
exit 1
;;
esac
}
setup_ripgrep