git-crap/git-send-xmpp

30 行
867 B
Bash

#!/bin/sh
# $KyokoNet: git-send-xmpp, v0.0.1 2022/11/11 22:14:55 akoizumi Exp $
#
# Send git patches over the XMPP protocol
# https://git.kyoko-project.wer.ee/koizumi.aoi/git-crap
for arg; do
case $arg in
-h) usage ;;
--pass=*) XMPPBRIDGE_PASSWORD="${arg#*=}" ;;
--user=*) XMPPBRIDGE_JID="${arg#*=}" ;;
--target=*) XMPPBRIDGE_PEER_JID="${arg#*=}" ;;
--diff=*) diff="${arg#*=}" ;;
*-*) printf "Unknown option %s\n" "$arg" ;;
*=*) export "${arg:?}" ;;
*) printf "Unknown argument: %s\n" "$arg" ;;
esac
done
if [ -z $XMPPBRIDGE_PASSWORD && -z $XMPPBRIDGE_JID && -z $XMPPBRIDGE_PEER_JID && -z $diff ]; then
usage
exit 1
else
printf "Sending patch file %s to recipient %s over XMPP\n" "${diff}" "${XMPPBRIDGE_PEER_JID}"
export XMPPBRIDGE_JID
export XMPPBRIDGE_PASSWORD
export XMPPBRIDGE_PEER_JID
cat $diff | xmppbridge
fi