#!/bin/sh -ef
# Find the maintainer of a package

# Use the current directory as the package name if no package is given.
[ -n "$1" ] || {
  # shellcheck disable=SC2086,SC2250
  export KISS_PATH=${PWD%/*}:$KISS_PATH
  set -- "${PWD##*/}"
}

kiss search "$@" | uniq -u | while read -r repo; do
  cd "${repo}"
  m=$(git log -1 version 2>/dev/null) || :
  m=${m##*Author: }
  m=${m%%>*}

  [ -n "${m}" ] || continue

  printf '=> %s\n%s>\n' "${PWD}" "${m}"
done
