Add check function

This commit is contained in:
42berlin 2023-03-28 00:27:29 +02:00
parent 6ed3c0f733
commit 150e7d4ff0
1 changed files with 17 additions and 0 deletions

17
.bashrc
View File

@ -56,3 +56,20 @@ fi
if [ -f /nfs/homes/tischmid/.config/synth-shell/better-history.sh ] && [ -n "$( echo $- | grep i )" ]; then
source /nfs/homes/tischmid/.config/synth-shell/better-history.sh
fi
check () {
URL="${1}"
DIR="/tmp/tmp_repo_$(date +%s)"
if [ -z "${URL}" ]; then
URL="$(git remote get-url origin)"
fi
git clone --quiet "${URL}" "${DIR}"
if [ -d "${DIR}" ]; then
norminette "${DIR}" && printf '\033[42m%s\033[m\n' "Norminette success" || printf '\033[41m%s\033[m\n' "Norminette fail!!!"
rm -rf "${DIR}"
else
printf '\033[41m%s\033[m\n' "Could not clone the repo"
fi
}