From 41d3d499bc73a1770f43dab15ef12eba7331db03 Mon Sep 17 00:00:00 2001 From: royalpinto007 Date: Sat, 30 Dec 2023 01:08:20 +0530 Subject: [PATCH] feat: add fmt githook This is something that I always want to do but I never started. So this is a good way to start. Signed-off-by: Vincenzo Palazzo --- contrib/pre-commit | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 contrib/pre-commit diff --git a/contrib/pre-commit b/contrib/pre-commit new file mode 100644 index 0000000..4b7e99b --- /dev/null +++ b/contrib/pre-commit @@ -0,0 +1,12 @@ +#!/bin/bash + +FMTCMD="${CARGO_FMT_CMD:cargo fmt -- --check}" + +# Redirect output to stderr. +exec 1>&2 + +unset RUST_LOG +set -e + +# check everything else +$FMTCMD