#!/bin/sh

SELF="$( basename $0 )"

if [ "$1" = "" -o "$1" = "--help" ]; then
  cat <<EOF
$SELF - list SlackBuilds by maintainer.

Usage: $SELF <maintainer>

<maintainer> does not need to be quoted, if it contains spaces (although
it can be).

If <maintainer> contains an @, it's assumed to be an email address,
otherwise it's treated as name. Watch out for obfuscated email
addresses!
EOF
  exit 0
fi

source ~/sbostuff/sbostuff.sh
cd $SBO_GITROOT || exit 1
if echo "$*" | grep -q '@'; then
  echo $( git grep 'EMAIL="'"$*"'"' '*/*/*.info' | cut -d/ -f2 )
else
  echo $( git grep 'MAINTAINER="'"$*"'"' '*/*/*.info' | cut -d/ -f2 )
fi
