Stop pre-commit hook from installing programs

This commit is contained in:
Kai A. Hiller 2020-12-13 21:24:44 +01:00
parent 7977e0b2da
commit 5d16b11ffc

View file

@ -1,16 +1,14 @@
#!/bin/sh
if ! which rustup &> /dev/null; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:$HOME/.cargo/bin
if ! which rustup &> /dev/null; then
echo "Failed to install rustup"
fi
if ! which cargo &> /dev/null; then
echo "Commit aborted! Please install cargo and rustfmt to check the code style of Fractal."
exit -1
fi
if ! rustup component list|grep rustfmt &> /dev/null; then
echo "Installing rustfmt.."
rustup component add rustfmt
if ! cargo fmt --help &> /dev/null; then
echo "Commit aborted! You need rustfmt to check the code style of Fractal."
echo "Install it via rustup ('rustup component add rustfmt') or your package manager."
exit -1
fi
echo "--Checking style--"