Last active
March 23, 2017 10:35
-
-
Save tombola/2721953ba9f2536942a789af4d3ed6dc to your computer and use it in GitHub Desktop.
List view modes used in current branches (from config filenames, rather than db).
This file contains hidden or 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
#!/usr/bin/env bash | |
list_node_viewmodes() { | |
read BRANCH | |
REPLACE='config/sync/core.entity_view_mode.node.' | |
if [[ $BRANCH ]]; then | |
echo '========='$BRANCH | |
echo '' | |
git ls-tree -r --name-only $BRANCH | grep "config\/sync\/core\.entity_view_mode\.node" | \ | |
while read VIEWMODES | |
do | |
VIEWMODE_NAME=$(python -c 'print "'$VIEWMODES'".replace("'$REPLACE'","")') | |
VIEWMODE_NAME=$(python -c 'print "'$VIEWMODE_NAME'".replace(".yml","")') | |
echo $VIEWMODE_NAME; | |
done | |
echo '' | |
fi | |
} | |
# local branches | |
compare_branch_viewmodes() { | |
git for-each-ref --format='%(refname:short)' refs/heads/ | \ | |
while read BRANCH | |
do | |
list_node_viewmodes $BRANCH | |
done | |
} | |
# include remote branches | |
compare_all_branch_viewmodes() { | |
git for-each-ref --format='%(refname:short)' | \ | |
while read BRANCH | |
do | |
list_node_viewmodes $BRANCH | |
done | |
} | |
cbv() { | |
compare_branch_viewmodes | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment