-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve dotfiles-update-modules script
Signed-off-by: Kare Nuorteva <[email protected]>
- Loading branch information
Showing
1 changed file
with
28 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |