1 |
yakumo_izuru |
1.1 |
#!/bin/sh |
2 |
|
|
# $TheSupernovaDuo: git-send-xmpp,v 0.0.4 2023/5/27 23:31:33 yakumo_izuru Exp $ |
3 |
|
|
# |
4 |
|
|
# Send git patches over the XMPP protocol |
5 |
|
|
# https://git.chaotic.ninja//yakumo.izuru/git-crap |
6 |
|
|
|
7 |
|
|
# I have a feeling I could totally do this in Golang, |
8 |
|
|
# if I wasn't inept with I/O handling in real programming |
9 |
|
|
usage() { |
10 |
|
|
cat <<EOF |
11 |
|
|
Usage |
12 |
|
|
git-send-xmpp --diff=<patch file> --pass=<password> --user=<user> --target=<target> |
13 |
|
|
EOF |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
for arg; do |
17 |
|
|
case $arg in |
18 |
|
|
-h) usage ;; |
19 |
|
|
--pass=*) pass="${arg#*=}" ;; |
20 |
|
|
--user=*) user="${arg#*=}" ;; |
21 |
|
|
--target=*) target="${arg#*=}" ;; |
22 |
|
|
--diff=*) diff="${arg#*=}" ;; |
23 |
|
|
*-*) printf "Unknown option %s\n" "$arg" ;; |
24 |
|
|
*=*) export "${arg:?}" ;; |
25 |
|
|
*) printf "Unknown argument: %s\n" "$arg" ;; |
26 |
|
|
esac |
27 |
|
|
done |
28 |
|
|
|
29 |
|
|
if [ -z $pass && -z $user && -z $target && -z $diff ]; then |
30 |
|
|
usage |
31 |
|
|
exit 1 |
32 |
|
|
else |
33 |
|
|
printf "Sending patch file %s to recipient %s over XMPP\n" "${diff}" "${target}" |
34 |
|
|
go-sendxmpp -u ${user} -p ${pass} -h ${diff} -a ${user} ${target} |
35 |
|
|
fi |