Created
August 12, 2020 12:01
-
-
Save kernoeb/86e96ff131aa4265d9c5a843419d13cb to your computer and use it in GitHub Desktop.
Get all git status in a directory, only if something's changed
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 | |
# Example : | |
# dir/ | |
# | - repo1 | |
# | - repo2 | |
grepmsg="rien à valider" # if french | |
print_equals () { | |
for ((i=0; i<=$(($1*2)); i++)); do printf =; done | |
} | |
print_spaces () { | |
for ((i=0; i<=$(($1/2)); i++)); do printf " "; done | |
} | |
for d in * | |
do | |
(if [ -d "$d/.git" ] | |
then | |
cd $d | |
if ! git status | grep -q "$grepmsg" | |
then | |
nb=${#d} | |
echo -e "\e[1m\e[92m" | |
print_equals $(($nb+1)) | |
echo | |
print_spaces $nb | |
echo -e "$d" | |
print_equals $(($nb+1)) | |
echo -e "\e[0m" | |
git status | |
echo | |
fi | |
fi); | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment