From cfc08ea26329d06c94e07e562a3c8548d398e85b Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Thu, 31 Oct 2024 16:55:46 +0100 Subject: [PATCH] Mention pre-commit in README --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4755796..05e2ed0 100644 --- a/README.md +++ b/README.md @@ -231,10 +231,24 @@ See [`fredrikekre/runic-action`](https://github.com/fredrikekre/runic-action) fo ### Git hooks -Runic can be run in a -[Git pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) -to automatically check formatting before committing. Here is an example hook -(`.git/hooks/pre-commit`): +Runic can be used together with [`pre-commit`](https://pre-commit.com/) using +[`fredrikekre/runic-pre-commit`](https://github.com/fredrikekre/runic-pre-commit). After +installing `pre-commit` you can add the following to your `.pre-commit-config.yaml` to run +Runic before each commit: + +```yaml +repos: + - repo: https://github.com/fredrikekre/runic-pre-commit + rev: v1.0.0 + hooks: + - id: runic +``` + +See [`fredrikekre/runic-pre-commit`](https://github.com/fredrikekre/runic-pre-commit) for +details. + +If you don't want to use `pre-commit` you can also use a plain git hook. Here is an example +hook (`.git/hooks/pre-commit`): ```sh #!/usr/bin/env bash