Skip to content

Commit 988a749

Browse files
committed
Introduce new function: warn
1 parent 8a6ef24 commit 988a749

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

bin/check_dates

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22

33

4+
function warn() { echo "${@}" >&2; }
5+
6+
47
function date_from_filename () {
58
local f="${1}"
69
echo "${f}" |
@@ -26,22 +29,22 @@ function main () {
2629
date_from_front_matter=$( date_from_front_matter "${file}" )
2730

2831
if [[ "${date_from_filename}" = '' ]] || [[ "${date_from_filename}" != "${date_from_front_matter}" ]]; then
29-
echo "Inconsist or missing date info: ${file}"
30-
echo " Date From Filename: '${date_from_filename}'"
31-
echo " Date From Front Matter: '${date_from_front_matter}'"
32+
warn "Inconsist or missing date info: ${file}"
33+
warn " Date From Filename: '${date_from_filename}'"
34+
warn " Date From Front Matter: '${date_from_front_matter}'"
3235
inconsistent=true
3336
else
34-
# echo "Consistent|${file}|${filename}|${date_from_filename}|${date_from_front_matter}|"
37+
# warn "Consistent|${file}|${filename}|${date_from_filename}|${date_from_front_matter}|"
3538
:
3639
fi
3740
done
3841

3942
# Exit with error if inconsistencies were found
4043
if $inconsistent; then
41-
echo "Inconsistencies detected. Please correct them."
44+
warn "Inconsistencies detected. Please correct them."
4245
exit 1
4346
else
44-
echo "All dates are consistent."
47+
warn "All dates are consistent."
4548
fi
4649
}
4750

0 commit comments

Comments
 (0)