Skip to content

Instantly share code, notes, and snippets.

@tobyS
Last active March 16, 2018 13:57
Show Gist options
  • Save tobyS/64bcb6c88812f17661428b0c8ac7787a to your computer and use it in GitHub Desktop.
Save tobyS/64bcb6c88812f17661428b0c8ac7787a to your computer and use it in GitHub Desktop.
Asking the developer if he ran the tests before pushing
#!/bin/sh
# Allows us to read user input below, assigns stdin to keyboard
exec < /dev/tty
while true; do
read -p "[Pre-Push] Did you run the tests? (Y/n) " yn
if [ "$yn" = "" ]; then
yn='Y'
fi
case $yn in
[Yy] ) echo "[Pre-Push] Great, then we'll push now ..."; exit;;
[Nn] ) echo "[Pre-Push] Sorry, then please do it!"; exit 1;;
* ) echo "Please answer y or n for yes or no.";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment