1 parent b471e1d commit b381959Copy full SHA for b381959
1 file changed
bin/dotfiles-update-modules
@@ -1,12 +1,30 @@
1
#!/bin/zsh
2
3
-cd
4
-cd .vim/bundle
5
-for a in `ls`; do
6
- cd $a
7
- git checkout master && git pull --rebase
8
- cd ..
9
-done
10
-cd ~/.oh-my-zsh
11
-git checkout master && git pull --rebase
12
+function usage() {
+ echo "Usage: `basename $0` [-h] [-u]" 1>&2
+ echo "stash, update and add modules, commit and pop stash" 1>&2
+ echo "-u only update modules" 1>&2
+ exit 1
+}
+
+if [[ "$1" == "-h" ]]; then
+ usage
+fi
13
14
+if [[ "$1" != "-u" ]]; then
15
+ dotfiles stash
16
17
+foreach module (`ls -d ~/.vim/bundle/* ~/.oh-my-zsh`)
18
+ echo "Updating $module"
19
+ cd $module
20
+ git checkout master
21
+ git pull
22
+ if [[ "$1" != "-u" ]]; then
23
+ dotfiles add $module
24
+ fi
25
+end
26
27
+ cd
28
+ dotfiles commit -s -m "Update modules"
29
+ dotfiles stash pop
30
0 commit comments