-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
create.sh
executable file
·65 lines (58 loc) · 1.11 KB
/
create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
usage()
{
echo "
Usage: git nostr create [options]
ex: git nostr create --secretkey c76bnwp...9mhscg --publickey 0as8f..xj05af --relay ws://nostr.nostrin.gs
# PUBLICKEY=`nostril --sec $SECRETKEY | jq --raw-output .pubkey`
Options:
--secretkey nostr secret key
--publickey nostr public key
--relay nostr relay url
"
exit 2
}
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h | --help)
usage
;;
--secretkey)
SECRETKEY=$2
shift
shift
;;
--relay)
RELAY="$2"
shift
shift
;;
*)
usage
;;
esac
done
if [ "$SECRETKEY" = "" ]; then
SECRETKEY=`git config nostr.secretkey`
fi
if [ "$RELAY" = "" ]; then
RELAY=`git config nostr.relay`
fi
if [ "$SECRETKEY" = "" ]; then
usage
fi
if [ "$RELAY" = "" ]; then
usage
fi
git log --reverse|
grep --line-buffered "^commit "|
sed 's/.* //g'|
grep --line-buffered .| awk\
-v secretkey="$SECRETKEY"\
-v relay="$RELAY" \
'{system("publish.sh\
--secretkey "secretkey"\
--relay "relay"\
--commitid "$1)}'