added dependency check for rg

This commit is contained in:
Emma Tebibyte 2022-11-11 23:56:48 -05:00
parent 066430ccba
commit 77f5d5c7ce
1 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,12 @@
#!/bin/sh
# Depends on: `rg` (ripgrep)
! rg --multiline --files-without-match --glob '*.rs' --pcre2 '(?<!\n)((//)|(#)) Copyright \(c\) \d+ [A-z, ]+\n((//)|(#)) SPDX-License-Identifier: .*\n'
set -e
# check if we have rg(1)
if ! command -v rg >/dev/null 2>&1; then
printf "%s: Missing dependency: rg(1)\n" "$0" 1>&2
exit 71 # sysexits(3) EX_OSERR
else
rg --multiline --files-without-match --glob '*.rs' --pcre2 \
'(?<!\n)((//)|(#)) Copyright \(c\) \d+ [A-z, ]+\n((//)|(#)) SPDX-License-Identifier: .*\n'
fi