-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstantshell.sh
executable file
·54 lines (51 loc) · 1.46 KB
/
instantshell.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
#!/bin/bash
# wrapper for non-interactive installation of instantshell
zshrun() {
if [ -z "$TMUX" ]; then
export TMUX=test
zsh -c "cd && source ~/.zshrc && $1"
unset TMUX
else
zsh -c "cd && source ~/.zshrc && $1"
fi
}
case "$1" in
"install")
[ -e "$HOME"/.cache/antidote ] || mkdir -p ~/.cache/antidote/
echo "source /usr/share/instantshell/zshrc" >~/.zshrc
zshrun "install_antidote_plugins" || exit 1
zshrun "echo 'installing'" || exit 1
echo "instantSHELL installation complete"
;;
"reinstall")
instantshell uninstall "$2" || exit
instantshell install
;;
uninstall)
if [ "$2" = "-f" ]; then
CONFIRMATION="y"
else
echo -n "this will clear your entire zsh configuration. Continue? (y/n) "
read -r CONFIRMATION
echo ""
fi
if [ "$CONFIRMATION" = "y" ]; then
[ -e ~/.zshrc ] && rm ~/.zshrc
[ -e ~/.cache/antidote/ ] && rm -rf ~/.cache/antidote/
else
exit 1
fi
;;
"update")
[ -e "$HOME"/.cache/antidote ] && mkdir -p ~/.cache/antidote/
zshrun "iantidote; antidote update"
zshrun "iantidote; antidote bundle < /usr/share/instantshell/bundle.txt > ~/.zsh_plugins.sh "
;;
*)
echo "usage: instantshell [COMMAND]
install install all instantSHELL dotfiles
reinstall remove and install all instantSHELL dotfiles
uninstall remove instantSHELL dotfiles
update update zsh plugins"
;;
esac