From 7f4c294758d0dcf49d9120f7ae5e404586b30967 Mon Sep 17 00:00:00 2001 From: femsci Date: Sat, 5 Nov 2022 01:11:03 +0100 Subject: [PATCH] Add README checker --- hooks/pre-commit.d/check-readme.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 hooks/pre-commit.d/check-readme.sh diff --git a/hooks/pre-commit.d/check-readme.sh b/hooks/pre-commit.d/check-readme.sh new file mode 100755 index 0000000..a1e19f0 --- /dev/null +++ b/hooks/pre-commit.d/check-readme.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +description() { + echo "Checks for README.md file with the proper extension." +} + +config() { + echo "README_BYPASS_EXT:bypasses extension check" + echo "README_BYPASS_ENO:bypasses execution halt when the README file is missing" +} + +if [[ -e README ]]; then + pinfo "README file found instead of README.md. Consider changing the extension..." + [[ -z $README_BYPASS_EXT ]] && exit 1 +else + if [[ -e README.md ]]; then + pinfo "README.md file found." + else + pwarn "No README file found..." + [[ -z $README_BYPASS_ENO ]] && exit 2 + fi +fi