-
Notifications
You must be signed in to change notification settings - Fork 26
/
install.sh
23 lines (18 loc) · 840 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
_CODE_CONNECT_PY=$(realpath ~)/.code-connect/code_connect.py
echo "> Downloading code_connect.py from https://raw.githubusercontent.com/chvolkmann/code-connect/main/functions/code_connect.py"
mkdir -p $(dirname $_CODE_CONNECT_PY)
wget -q -O "$_CODE_CONNECT_PY" "https://raw.githubusercontent.com/chvolkmann/code-connect/main/functions/code_connect.py"
chmod +x "$_CODE_CONNECT_PY"
# Add the alias to ~/.bashrc if not already done
if [[ -z $(cat ~/.bashrc | grep "alias code=") ]]; then
echo "> Alias added to ~/.bashrc"
echo "alias code='$_CODE_CONNECT_PY'" >> ~/.bashrc
else
echo "> code already aliased in ~/.bashrc, skipping"
fi
# Register the alias in the current shell
alias code="$_CODE_CONNECT_PY"
echo "> code-connect installed successfully!"
echo ">"
echo "> You can now use the code command, try it!"