36 行
964 B
Bash
36 行
964 B
Bash
#!/bin/sh
|
|
# $TheSupernovaDuo: git-send-xmpp,v 0.0.4 2023/5/27 23:31:33 yakumo_izuru Exp $
|
|
#
|
|
# Send git patches over the XMPP protocol
|
|
# https://git.chaotic.ninja/yakumo.izuru/git-crap
|
|
|
|
# I have a feeling I could totally do this in Golang,
|
|
# if I wasn't inept with I/O handling in real programming
|
|
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}"
|
|
go-sendxmpp -u ${user} -p ${pass} -h ${diff} -a ${user} ${target}
|
|
fi
|