-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup-exa
executable file
·43 lines (31 loc) · 951 Bytes
/
setup-exa
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
#!/usr/bin/env bash
set -eu
declare -r prefix_path="${HOME}/.local"
declare -r temp_dir="$(mktemp -d /tmp/exa--XXXXXXXXX)"
move() {
local -r src="$1"
local -r dest="$2"
local -r dest_dir="$(dirname "$dest")"
if [ ! -d "${dest_dir}" ]; then
mkdir -p "${dest_dir}"
fi
mv "${src}" "${dest}"
}
cd "${temp_dir}"
echo "Downloading archive..."
gh release download --repo ogham/exa --pattern "*linux-x86_64-v*.zip"
echo "Extracting archive..."
unzip -o -q "${temp_dir}/*.zip"
echo "Setting up: exa"
if test "$(uname -m)" = "aarch64"; then
cargo install exa
else
move ./bin/exa "${prefix_path}/bin/exa"
fi
move ./man/exa.1 "${prefix_path}/man/man1/exa.1"
move ./man/exa_colors.5 "${prefix_path}/man/man5/exa_colors.5"
move ./completions/exa.bash "${prefix_path}/share/bash-completion/completions/exa"
move ./completions/exa.zsh "${prefix_path}/share/zsh/completions/_exa"
echo "Cleaning up..."
rm -rf "${temp_dir}"
echo "Done!"