-
Notifications
You must be signed in to change notification settings - Fork 25
/
uninstall.sh
executable file
·68 lines (47 loc) · 1.09 KB
/
uninstall.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
64
65
66
67
68
#!/bin/bash
# https://github.com/chvolkmann/code-connect
CODE_CONNECT_INSTALL_DIR=~/.code-connect
####
# Fancy output helpers
c_cyan=`tput setaf 7`
c_red=`tput setaf 1`
c_magenta=`tput setaf 6`
c_grey=`tput setaf 8`
c_green=`tput setaf 10`
c_reset=`tput sgr0`
c_fg="$c_cyan"
c_log="$c_grey"
c_err="$c_red"
c_emph="$c_magenta"
c_path="$c_green"
print () {
echo "$c_fg$@$c_reset"
}
log () {
echo "$c_log$@$c_reset"
}
error () {
echo "$c_err$@$c_reset"
}
#####
alias-exists () {
name="$1"
cat ~/.bashrc | grep -q "alias $name=*"
}
remove-alias () {
name="$1"
if alias-exists "$name"; then
log "Removing alias ${c_emph}$name${c_log} from ${c_path}~/.bashrc"
sed -i "/alias $name=/d" ~/.bashrc
else
log "Alias for ${c_emph}$name${c_log} not registered in ${c_path}~/.bashrc${c_log}, skipping"
fi
unalias $name > /dev/null 2>&1
}
#####
remove-alias "code"
remove-alias "code-connect"
log "Removing ${c_path}$CODE_CONNECT_INSTALL_DIR"
rm -rf $CODE_CONNECT_INSTALL_DIR
print ""
print "${c_emph}code-connect${c_fg} uninstalled successfully!"