From 43449e59eeb90544816cc62d8f3ad1a20b24c481 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 26 Aug 2023 23:45:52 +0100 Subject: [PATCH] build-configs(update) --- .githooks/prepare-commit-msg | 4 ++-- justfile | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg index d7bf4c7..7fa07bc 100755 --- a/.githooks/prepare-commit-msg +++ b/.githooks/prepare-commit-msg @@ -2,8 +2,6 @@ # Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. -set -euo pipefail - # Load the issue ID from an `.issue-id` file within the project and replace the # `ISSUE_ID` placeholder within a Git commit message. # @@ -13,6 +11,8 @@ set -euo pipefail # This also works with multiple issue IDs in the same string, e.g. # "OD-123 OD-456". +set -euo pipefail + PROJECT_DIR=$(git rev-parse --show-toplevel) # Get the root directory of the repo ISSUE_FILE="$PROJECT_DIR/.issue-id" diff --git a/justfile b/justfile index d255f5d..d43ad25 100644 --- a/justfile +++ b/justfile @@ -33,6 +33,25 @@ install *args: +# Enable or disable Git hooks +git-hooks command: + #!/usr/bin/env bash + set -euo pipefail + + case "{{ command }}" in + "on") + echo "Enabling Git hooks..." + git config core.hooksPath .githooks + ;; + "off") + echo "Disabling Git hooks..." + git config --unset core.hooksPath + ;; + *) + echo "Error: Invalid argument. Must be either 'on' or 'off'" + ;; + esac + _exec +args: docker compose exec -T {{ args }}