Skip to content

Commit

Permalink
Add support for manual hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
arcuru committed May 20, 2022
1 parent 521a524 commit 3d619ab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/pre-commit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ let
inherit (lib)
attrNames
concatStringsSep
compare
filterAttrs
literalExample
mapAttrsToList
Expand Down Expand Up @@ -172,8 +173,14 @@ let
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git commit -m "init"
echo "Running: $ pre-commit run --all-files"
${cfg.package}/bin/pre-commit run --all-files
if [[ ${toString (compare install_stages [ "manual" ])} -eq 0 ]]
then
echo "Running: $ pre-commit run --hook-stage manual --all-files"
${cfg.package}/bin/pre-commit run --hook-stage manual --all-files
else
echo "Running: $ pre-commit run --all-files"
${cfg.package}/bin/pre-commit run --all-files
fi
exitcode=$?
git --no-pager diff --color
touch $out
Expand Down

0 comments on commit 3d619ab

Please sign in to comment.