Last active
August 29, 2015 13:57
-
-
Save gilligan/9675235 to your computer and use it in GitHub Desktop.
vundle.sh: fast bundle updates hack from the shell with parallel
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
#!/bin/bash | |
VIM_DIR=~/.vim/ | |
BUNDLE_DIR=$VIM_DIR/bundle | |
sanity_check() { | |
test -d $1 || { echo "Error: " $BUNDLE_DIR "directory does not exist."; exit 1; } | |
command -v git >/dev/null 2>&1 || { echo "Error: cannot find git executable"; exit 1; } | |
command -v parallel >/dev/null 2>&1 || { echo "Error: cannot find parallel executable"; exit 1; } | |
} | |
vundle_update() { | |
echo "Updating bundles in $1 ..." | |
echo "" | |
parallel --gnu -j4 cd {}\; tput setaf 2 \; basename {}\; tput sgr0 \; git pull :::: <(find $1 -maxdepth 1) | |
} | |
vundle_done () { | |
echo "" | |
echo "All done. Remember to run :BundleDocs" | |
} | |
sanity_check $BUNDLE_DIR | |
vundle_update $BUNDLE_DIR | |
vundle_done |
@ole-tange thanks. I removed the --no-notice argument. To be honest mostly because the version on ubuntu does not even recognize it. I still find it spammy and weird. If all command line tools behaved like that it would be rather unpleasent.
Thanks for the comment. I actually still don't really know about parallel's capabilities at all. I just hacked it together to the point that it worked yesterday. I should actually read the manpage at some point :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can avoid the :::: <() construct by putting the 'find' before:
But it would be even shorter to do:
Also please consider not using --no-notice: It is extremely easy to permanently silence the notice by running --bibtex just a single time. Citations help funding further development; and it won't cost you a cent. The notice was introduced because a majority of users were not aware of the citation requirement. Using --no-notice will defeat that purpose.