Make pre-commit hook work for non-terminal environments
This commit is contained in:
parent
7d9e170735
commit
32ccb30d31
1 changed files with 7 additions and 0 deletions
|
@ -19,6 +19,13 @@ install_rustfmt() {
|
||||||
|
|
||||||
if ! which cargo &> /dev/null || ! cargo fmt --help &> /dev/null; then
|
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."
|
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 ""
|
||||||
echo "y: Install rustfmt via rustup"
|
echo "y: Install rustfmt via rustup"
|
||||||
echo "n: Don't install rustfmt and perform the commit"
|
echo "n: Don't install rustfmt and perform the commit"
|
||||||
|
|
Loading…
Reference in a new issue