-
Notifications
You must be signed in to change notification settings - Fork 0
/
link-vscode.sh
executable file
·63 lines (49 loc) · 1.47 KB
/
link-vscode.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
#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo
echo
echo "${green}---------------------------${reset}"
echo "${green}--- link-vscode ---${reset}"
echo "${green}---------------------------${reset}"
echo
source ./.env
source_file="$SOURCE_ROOT_PATH/simpany/.vscode"
target_file="$LINK_VSCODE_PROJECT_SIMPANY_PATH/simpany/.vscode"
echo "🧪 try: ln ${source_file} ${target_file}"
function fun_overwrite() {
if [ -e "${target_file}" ]; then
echo -e "\t ⁉️ ${red}target exist, plz rename, backup it...${reset}"
else
read -p "❓ input your username? " username
ln -s "${source_file}" "${target_file}"
echo -e "\t ⭕️ ${green}link created!${reset}"
fi
}
while true; do
read -p "❓ Do you want to overwrite .vscode? " yn
case $yn in
[Yy]* ) fun_overwrite; break;;
[Nn]* ) echo; break;;
* ) echo -e "\t ⁉️ Please answer yes or no.";;
esac
done
#
source_file="$SOURCE_ROOT_PATH/simpany-member2/.vscode"
target_file="$LINK_VSCODE_PROJECT_SIMPANY_PATH/simpany-member2/.vscode"
echo "🧪 try: ln ${source_file} ${target_file}"
while true; do
read -p "❓ Do you want to overwrite .vscode? " yn
case $yn in
[Yy]* ) fun_overwrite; break;;
[Nn]* ) echo; break;;
* ) echo -e "\t ⁉️ Please answer yes or no.";;
esac
done
echo
echo "${green}-------------${reset}"
echo "${green}--- Done. ---${reset}"
echo "${green}-------------${reset}"
echo
echo