Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recursively scan git repos and install git-secrets
#!/bin/bash
# Usage examples:
# ./update-all-repos.sh
# ./update-all-repos.sh ~/Sites ~/Projects
HIGHLIGHT="\e[01;34m"
NORMAL='\e[00m'
function update {
local d="$1"
if [ -d "$d" ]; then
cd "$d" > /dev/null
if [ -d ".git" ]; then
printf "%b\n" "\n${HIGHLIGHT}Updating `pwd`$NORMAL"
git secrets --install
else
scan *
fi
cd .. > /dev/null
fi
}
function scan {
for x in $*; do
update "$x"
done
}
function updater {
if [ "$1" != "" ]; then cd "$1" > /dev/null; fi
printf "%b\n" "${HIGHLIGHT}Scanning ${PWD}${NORMAL}"
scan *
}
if [ "$1" == "" ]; then
updater
else
for dir in "$@"; do
updater "$dir"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.