34 行
887 B
Bash
34 行
887 B
Bash
#!/bin/sh
|
|
# $KyokoNet: git-send-xmpp, v0.0.3, 2022/11/22 17:48:03 akoizumi Exp $
|
|
#
|
|
# Send git patches over the XMPP protocol
|
|
# https://git.kyoko-project.wer.ee/koizumi.aoi/git-crap
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage
|
|
git-send-xmpp --diff=<patch file> --pass=<password> --user=<user> --target=<target>
|
|
EOF
|
|
}
|
|
|
|
for arg; do
|
|
case $arg in
|
|
-h) usage ;;
|
|
--pass=*) pass="${arg#*=}" ;;
|
|
--user=*) user="${arg#*=}" ;;
|
|
--target=*) target="${arg#*=}" ;;
|
|
--diff=*) diff="${arg#*=}" ;;
|
|
*-*) printf "Unknown option %s\n" "$arg" ;;
|
|
*=*) export "${arg:?}" ;;
|
|
*) printf "Unknown argument: %s\n" "$arg" ;;
|
|
esac
|
|
done
|
|
|
|
if [ -z $pass && -z $user && -z $target && -z $diff ]; then
|
|
usage
|
|
exit 1
|
|
else
|
|
printf "Sending patch file %s to recipient %s over XMPP\n" "${diff}" "${target}"
|
|
xmppc --jid ${user} --pwd ${pass} -m message chat ${target} "$(curl -sF file=@$diff https://ttm.sh)"
|
|
fi
|