Skip to content

Instantly share code, notes, and snippets.

@tombola
Last active March 23, 2017 10:35
Show Gist options
  • Save tombola/2721953ba9f2536942a789af4d3ed6dc to your computer and use it in GitHub Desktop.
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).
#!/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