-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathissue.sh
executable file
·87 lines (77 loc) · 1.82 KB
/
issue.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
usage()
{
echo "
Usage: git nostr issue [options] --secretkey --publickey --relay --title --description
ex: git nostr issue --secretkey npub1rep06k4pxl3alwl9a920h6vn27fq93mxf3xer7crq5xz89s6fh7qjwp8xt --publickey 0f578badfbc982c36aac5ca8ea973a0bea5ab93adaef9885e163fbe8d7e5e631 --relay ws://nostr.nostrin.gs --title "feature new issues command" --description "issues are like notes with a title, description, and public key of the related repository"
add a new issue referencing a git repository public key
Options:
--publickey nostr public key
--relay nostr relay url
"
exit 2
}
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h | --help)
usage
;;
--title)
TITLE=$2
shift
shift
;;
--description)
DESCRIPTION=$2
shift
shift
;;
--publickey)
PUBLICKEY=$2
shift
shift
;;
--secretkey)
SECRETKEY=$2
shift
shift
;;
--relay)
RELAY="$2"
shift
shift
;;
*)
TITLE="$1"
shift
;;
esac
done
if [ "$RELAY" = "" ]; then
RELAY=`git config nostr.relay`
fi
if [ "$RELAY" = "" ]; then
usage
exit 1
fi
if [ "$SECRETKEY" = "" ]; then
SECRETKEY=`git config nostr.secretkey`
fi
if [ "$PUBLICKEY" = "" ]; then
PUBLICKEY=`git config nostr.publickey`
fi
if [ "$PUBLICKEY" = "" ]; then
PUBLICKEY=`nostril --sec $SECRETKEY | jq --raw-output .pubkey`
fi
if [ "$PUBLICKEY" = "" ]; then
usage
fi
if [ "$TITLE" = "" ]; then
usage
fi
ISSUEID=`nostril --envelope --sec "$SECRETKEY" --kind 7777 --tag purpose "git-nostr-issue" --tag title "$TITLE" --content "$DESCRIPTION" -p $PUBLICKEY |\
tee\
>(websocat "$RELAY" | jq -c .|grep OK | jq --raw-output .[1])\
>/dev/null`