Created
November 11, 2022 04:11
-
-
Save devanoneth/da44470f9952e0c36addb12bb7cb88a7 to your computer and use it in GitHub Desktop.
Pre-commit hook for Foundry
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 | |
BWHITE='\033[1;37m' | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' | |
printf "Running ${BWHITE}forge fmt${NC}... \n" | |
if forge fmt &>/dev/null; then | |
printf "${GREEN}Formatted!${NC} \n" | |
else | |
printf "${RED}error running ${BWHITE}forge fmt${NC} \n" | |
exit 1 | |
fi | |
printf "Running ${BWHITE}forge snapshot${NC}... \n" | |
if forge snapshot &>/dev/null; then | |
printf "${GREEN}Snapshotted!${NC} \n" | |
else | |
printf "${RED}error running ${BWHITE}forge snapshot${NC} \n" | |
exit 1 | |
fi | |
git add . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment