Make pre-commit hook work for non-terminal environments

This commit is contained in:
Kai A. Hiller 2020-12-14 19:06:48 +01:00 committed by Kai Hiller
parent 7d9e170735
commit 32ccb30d31

View file

@ -19,6 +19,13 @@ install_rustfmt() {
if ! which cargo &> /dev/null || ! cargo fmt --help &> /dev/null; then
echo "Can't check Fractal's code style, because rustfmt could not be run."
if [ ! -t 1 ]; then
# No input is possible
echo "Performing commit."
exit 0
fi
echo ""
echo "y: Install rustfmt via rustup"
echo "n: Don't install rustfmt and perform the commit"