ghostfolio/git-hooks/pre-commit
Martin Mui e7d4641d13
Feature/reload data on logo click (#2959)
* Reload data on logo click

* Update changelog
2024-02-07 21:03:28 +01:00

27 lines
610 B
Bash

#!/bin/bash
# Will check if "yarn format" is run before executing.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
echo "Running yarn format"
# Run the command and loop over its output
FILES_TO_STAGE=""
i=0
while IFS= read -r line; do
# Process each line here
((i++))
if [ $i -le 2 ]; then
continue
fi
if [[ $line == Done* ]]; then
break
fi
FILES_TO_STAGE="$FILES_TO_STAGE $line"
done < <(yarn format )
git add $FILES_TO_STAGE
echo "Files formatted. Committing..."