-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·51 lines (45 loc) · 1.24 KB
/
install
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
#!/bin/sh
#################### variables ####################
# shellcheck disable=SC2034
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
BLUE='\033[34m'
MAGENTA='\033[35m'
CYAN='\033[36m'
WHITE='\033[37m'
RESET='\033[0m'
#################### main ####################
if ! command -v git >/dev/null 2>&1; then
echo "${RED}ERROR:${RESET} git command not found"
exit 1
fi
if [ -d ~/.yatte ]; then
echo "${RED}ERROR:${RESET} ~/.yatte already exists"
exit 1
fi
echo "${GREEN}INFO:${RESET} Cloning yatte to ~/.yatte"
git clone https://github.com/haruyuki-16278/yatte.git ~/.yatte
case $SHELL in
"/usr/bin/bash")
echo "# yatte" >> ~/.bashrc
echo "export PATH=\$PATH:~/.yatte/bin" >> ~/.bashrc
echo "" >> ~/.bashrc
;;
"/usr/bin/zsh")
echo "# yatte" >> ~/.zshrc
echo "export PATH=\$PATH:~/.yatte/bin" >> ~/.zshrc
echo "" >> ~/.zshrc
;;
*)
# shellcheck disable=SC2116
cat <<EOF
$(echo "${YELLOW}WARNING:${RESET}") $SHELL is not supported.
Please add ~/.yatte/bin to your PATH manually.
like: export PATH=\$PATH:~/.yatte/bin >> ~/.bashrc
EOF
;;
esac
echo "${GREEN}INFO:${RESET} Installed yatte to ~/.yatte/bin"
export PATH="$PATH:~/.yatte/bin"
echo "${GREEN}INFO:${RESET} Successfully installed ${CYAN}yatte${RESET}"