hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit bda33578fb3f93d4f2a652a14ba2aeaa9ceebb31
parent 7c3e4a302019d4fd5ea27d2a8c6debb8d65be2b2
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sun, 23 Apr 2023 02:44:04 -0400

contrib: add contributors.sh

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Acontrib/contributors.sh | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/contrib/contributors.sh b/contrib/contributors.sh @@ -0,0 +1,34 @@ +#!/bin/sh -eu + +authors= + +while true; do + files=${1:-.} + if [ -d "$files" ]; then + files=$(find "${1:-.}" -name '*.ha' -o -name '*.s' -o -name README) + fi + + for file in $files; do + authorinfo=$(git blame "$file" --porcelain --incremental) + + # Format as: Author Name <test@example.com> + while read -r line; do + case "$line" in + "author "*) author=$(printf '%s' "$line" | sed 's/author //') ;; + "author-mail "*) mail=$(printf '%s' "$line" | sed 's/author-mail //') ;; + "filename "*) authors=$(printf '%s\n%s' "$authors" "$author $mail") ;; + *) ;; + esac + done << EOF + $authorinfo +EOF + done + + if [ $# -eq 1 ]; then + break + fi + shift 1 +done + +# Get only the unique author names +printf '%s\n' "$authors" | tail -n+2 | sort -u