#!/bin/zsh
BUNDLE=$(realpath ${0:h})
# set -x
# for d in $BUNDLE/*(/); do
# cd $d
# git pull
# done
cd ${0:h}
for conf in $BUNDLE/*/.git/config; do
d=${${conf:h}:h}
url=$( sed -n '/^[ ]*url[ ]*=/{ s/^[^=]*=[ ]*//; p }' <$conf )
print -r - $d $url
[[ $url == *://* ]] || { print invalid url; exit 1}
git clone --depth=1 -- $url ${d}.new/ || exit $?
mv ${d}{,.old} || exit $?
mv ${d}{.new,} || exit $?
rm -rf -- ${d}.old || exit $?
done
# update help tags via pathogen
vim -c Helptags -c quit
bzr --no-plugins add $BUNDLE