Skip to content

Commit b381959

Browse files
committed
Improve dotfiles-update-modules script
Signed-off-by: Kare Nuorteva <kare.nuorteva@me.com>
1 parent b471e1d commit b381959

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

bin/dotfiles-update-modules

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
#!/bin/zsh
22

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-
cd
3+
function usage() {
4+
echo "Usage: `basename $0` [-h] [-u]" 1>&2
5+
echo "stash, update and add modules, commit and pop stash" 1>&2
6+
echo "-u only update modules" 1>&2
7+
exit 1
8+
}
9+
10+
if [[ "$1" == "-h" ]]; then
11+
usage
12+
fi
13+
14+
if [[ "$1" != "-u" ]]; then
15+
dotfiles stash
16+
fi
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+
if [[ "$1" != "-u" ]]; then
27+
cd
28+
dotfiles commit -s -m "Update modules"
29+
dotfiles stash pop
30+
fi

0 commit comments

Comments
 (0)