Last active
August 29, 2015 14:26
-
-
Save mlms13/743e6ced81f799c64aa7 to your computer and use it in GitHub Desktop.
Update haxelib dev repos in fish-shell
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
function uphxlib | |
# upgrade normal haxe repositories | |
echo 'a' | haxelib upgrade | |
# keep track of the current directory | |
set current_dir (pwd) | |
# update all 'dev' repo git repositories | |
for lib in (haxelib list | cut -d: -f2- | grep 'dev:') | |
set dev_dir (echo $lib | rev | cut -c 2- | rev | cut -d '[' -f2- | cut -c5-) | |
echo $dev_dir | |
cd $dev_dir | |
set git_repo (basename (git remote show -n origin | grep Fetch | cut -d: -f2-)) | |
set current_branch (git rev-parse --abbrev-ref HEAD) | |
if not git diff-index --quiet HEAD -- | |
set_color red | |
echo 'Not updating library with uncommitted changes:' $git_repo | |
else if not echo $current_branch | grep 'master' > /dev/null | |
set_color red | |
echo 'Not updating library' $git_repo 'on branch' $current_branch | |
else if git pull > /dev/null | |
set_color green | |
echo 'Updated library:' $git_repo | |
else | |
set_color red | |
echo 'Failed to update library:' $git_repo | |
end | |
set_color normal | |
echo '' | |
end | |
# change back to original directory | |
cd $current_dir | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment