blob: 317ed48c0ecca504bc6ce074bc4de63d7082e26b2c4246a866d549d26889be5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
# automatically configured by git-annex
git annex pre-commit .
# check grammar of staged Markdown files
check_grammar() {
# get list of staged Markdown files (added or modified)
staged_files=$(git diff --cached --name-only --diff-filter=AM | grep '\.md$')
[ -z "$staged_files" ] && return 0
printf "Checking grammar of staged files.\n"
language_tool_python --picky $staged_files
printf "Proceed with commit? (y/n): "
read yn < /dev/tty
[ "$yn" == "${yn#[Yy]}" ] && return 1
return 0
}
# run grammar check
check_grammar
if [ $? -ne 0 ]; then
printf "Aborted.\n"
exit 1
fi
|