Skip to content

Commit

Permalink
Improve dotfiles-update-modules script
Browse files Browse the repository at this point in the history
Signed-off-by: Kare Nuorteva <[email protected]>
  • Loading branch information
kare committed May 7, 2014
1 parent b471e1d commit b381959
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions bin/dotfiles-update-modules
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
#!/bin/zsh

cd
cd .vim/bundle
for a in `ls`; do
cd $a
git checkout master && git pull --rebase
cd ..
done
cd ~/.oh-my-zsh
git checkout master && git pull --rebase
cd
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

if [[ "$1" != "-u" ]]; then
dotfiles stash
fi
foreach module (`ls -d ~/.vim/bundle/* ~/.oh-my-zsh`)
echo "Updating $module"
cd $module
git checkout master
git pull
if [[ "$1" != "-u" ]]; then
dotfiles add $module
fi
end
if [[ "$1" != "-u" ]]; then
cd
dotfiles commit -s -m "Update modules"
dotfiles stash pop
fi

0 comments on commit b381959

Please sign in to comment.