Skip to content

Commit

Permalink
Merge pull request cachix#146 from patricksjackson/manual
Browse files Browse the repository at this point in the history
Add support for manual only hooks
  • Loading branch information
domenkozar authored Aug 4, 2022
2 parents f436e6d + 3d619ab commit e8211b1
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 @@ -175,8 +176,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 e8211b1

Please sign in to comment.