-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·58 lines (52 loc) · 1.14 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
#!/bin/bash
Usage() {
echo "Usage: $0 [--remove-cache <true|false>] [--install-dir <install-dir>] [--help]"
echo "args can be one or more of the following :"
echo " --remove-cache | -r : Remove cache. Default: true"
echo " --install-dir : Installation directory. Default: $HOME/.homecli"
echo " --help | -h : Show this help message"
exit 1
}
while true; do
case "$1" in
--remove-cache | -r)
REMOVE_CACHE=$2
shift 2
;;
--install-dir)
INSTALL_DIR=$2
shift 2
;;
--help | -h)
Usage
;;
-*)
echo "Unknown option: $1"
Usage
;;
*)
break
;;
esac
done
INSTALL_DIR=${INSTALL_DIR:-${HOMECLI_INSTALL_DIR:-$HOME/.homecli}}
REMOVE_CACHE=${REMOVE_CACHE:-true}
# remove config files
rm ~/.config/nvim \
~/.config/tmux \
~/.config/fish \
~/.mambarc
# remove nvim plugins
rm -rf ~/.local/share/nvim
# remove cache
if [ "$REMOVE_CACHE" = "true" ]; then
rm -rf $INSTALL_DIR
elif [ "$REMOVE_CACHE" = "false" ]; then
echo "remove cache skipped"
else
echo "invalid argument: $REMOVE_CACHE (should be true or false)"
echo "usage: $0 [true|false]"
exit 1
fi
# remove alias fish=xxx
sed -i '/alias fish=/d' ~/.bashrc