pattern, not file
This commit is contained in:
parent
31d8bb1fd6
commit
42abb1791d
26
\
26
\
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# check usage
|
||||
if ! test -n "$1"; then
|
||||
printf "Usage: %s [file...]\n" "$0" 1>&2
|
||||
exit 64 # sysexits(3) EX_USAGE
|
||||
fi
|
||||
|
||||
# check if we have rg(1); if not, use find(1) and sed(1) instead
|
||||
if ! command -v rg >/dev/null 2>&1; then
|
||||
files="$(find "$PWD" -name "$1")"
|
||||
for file in $files; do
|
||||
if ! test -n \
|
||||
"$(sed -n \
|
||||
'\|Copyright\|p' \
|
||||
<"$file")"
|
||||
then
|
||||
! test "$file" = "$1" && printf "%s\n" "$file"
|
||||
fi
|
||||
done
|
||||
else
|
||||
rg --multiline --files-without-match --glob "$1" --pcre2 \
|
||||
'(?<!\n)((//)|(#)) Copyright \(c\) \d+ [A-z, ]+\n((//)|(#)) SPDX-License-Identifier: .*\n'
|
||||
fi
|
|
@ -4,7 +4,7 @@ set -e
|
|||
|
||||
# check usage
|
||||
if ! test -n "$1"; then
|
||||
printf "Usage: %s [file...]\n" "$0" 1>&2
|
||||
printf "Usage: %s [pattern...]\n" "$0" 1>&2
|
||||
exit 64 # sysexits(3) EX_USAGE
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue