forked from KAnggara75/dotfile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfc.sh
More file actions
executable file
·43 lines (38 loc) · 862 Bytes
/
fc.sh
File metadata and controls
executable file
·43 lines (38 loc) · 862 Bytes
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
set -u
abort() {
printf "%s\n" "$@"
exit 1
}
download() {
if command -v curl >/dev/null 2>&1; then
curl -fsSL "$1"
else
wget -qO- "$1"
fi
}
get_url() {
url="$(curl -s https://api.github.com/repos/tonsky/FiraCode/releases/latest |
grep "browser_download_url.*zip" |
cut -d : -f 2,3 |
tr -d \")"
if command -v curl >/dev/null 2>&1; then
curl -fsSL $url
else
wget -qO- $url
fi
}
main() {
export LC_CTYPE="en_US.UTF-8"
brew install fontconfig;
if (fc-list) | grep -q "FiraCode"; then
echo "FiraCode already installed."
else
echo "Installing FiraCode."
get_url | tar -xz -C ~/Library/Fonts --strip-components=1 || return 1
rm ~/Library/Fonts/FiraCode-*.woff
rm ~/Library/Fonts/FiraCode-*.woff2
rm ~/Library/Fonts/FiraCode-VF.ttf
rm ~/Library/Fonts/FiraCode-Retina.ttf
fi
}
main