Re-enable shfmt in pre-commit hook

This commit is contained in:
Marko Korhonen 2022-09-16 20:08:42 +03:00
parent 7e48c8f75a
commit 4255c7eba0
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890

View file

@ -31,14 +31,14 @@ if [ "$num_staged_lua" -gt 0 ]; then
fi
# Run shfmt on staged shell scripts
#staged_sh=$(echo "$staged_files" | grep -E '(.sh$|pre-commit)' || true)
#num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true)
#if [ "$num_staged_sh" -gt 0 ]; then
# printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh"
# shfmt -w "$staged_sh"
# printf "Re-staging\n\n"
# git add "$staged_sh"
#fi
staged_sh=$(echo "$staged_files" | grep -E '(.sh$|pre-commit)' || true)
num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true)
if [ "$num_staged_sh" -gt 0 ]; then
printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh"
shfmt -w "$staged_sh"
printf "Re-staging\n\n"
git add "$staged_sh"
fi
# Run prettier on all other staged files
# that are supported