Skip to content

Commit 2902045

Browse files
committed
prelude.sh: Add err function
1 parent c62e67f commit 2902045

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pre-commit-hook.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ echo -e "${GREEN} ###### RUNNING PRE-COMMIT HOOKS ###### ${NC}"
99

1010
files=$(find . -type f -name "*.sh" -exec shfmt -l {} \;)
1111
if [ -n "$files" ]; then
12-
echo "Error: The following shell files need formatting:"
13-
echo "$files"
14-
echo ""
15-
echo "Running: find . -type f -name \"*.sh\" -exec shfmt -w {} \\;"
12+
err "Error: The following shell files need formatting:"
13+
err "$files"
14+
err
15+
err "Running: find . -type f -name \"*.sh\" -exec shfmt -w {} \\;"
1616
find . -type f -name "*.sh" -execdir shfmt -w {} \;
17-
echo "git add the formatted files and commit again"
17+
err "git add the formatted files and commit again"
1818
exit 1
1919
fi
2020

prelude.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,8 @@ if [[ "${__INITPC_PRELUDE_SOURCED__}" != "true" ]]; then
178178
done
179179
set -x
180180
}
181+
err()
182+
{
183+
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
184+
}
181185
fi

0 commit comments

Comments
 (0)