-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·67 lines (61 loc) · 1.74 KB
/
setup
File metadata and controls
executable file
·67 lines (61 loc) · 1.74 KB
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
#!/bin/bash
# http://tuxtweaks.com/2014/05/bash-getopts/
set -e
export DOTFILES=~/.dotfiles
SCRIPT=`basename ${BASH_SOURCE[0]}`
#Help function
function HELP {
echo -e \\n"Help documentation for ${SCRIPT}."\\n
echo -e "Basic usage: ./$SCRIPT -g i3"\\n
echo "Command line switches are optional. The following switches are recognized."
echo "-v --Downloads vim-plug and installs all vim plugins."
echo "-n --Downloads vim-plug and installs all neovim plugins."
echo "-g --Updates git submodules."
echo -e "-h --Displays this help message. No further functions are performed."\\n
echo -e "Example: $SCRIPT -vng i3 zsh xorg"\\n
exit 1
}
NUMARGS=$#
if [ $NUMARGS -eq 0 ]; then
HELP
fi
while getopts :vnsh FLAG; do
case $FLAG in
v)
echo "Install vim-plug for vim"
mkdir -p ~/.vim/backup
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstall +qall
echo "Install vim plugins"
;;
n)
echo "Install vim-plug for neovim"
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "Install neovim plugins"
nvim +PlugInstall +qall
;;
s)
echo "Update git submodules"
git submodule update --init --recursive
;;
h)
HELP
;;
\?) #unrecognized option - show help
echo -e \\n"Option -$OPTARG not allowed."
HELP
;;
esac
done
shift $((OPTIND-1)) #This tells getopts to move on to the next argument.
while [ $# -ne 0 ]; do
MODULE=$1
echo "Stowing module $MODULE"
if [[ "$MODULE" == 'xorg' ]]; then
sudo stow -t / $MODULE
else
stow $MODULE
fi
shift
done
exit 0