-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgicr.sh
45 lines (36 loc) · 1.07 KB
/
gicr.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
#!/bin/bash
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-u|--user)
USER="$2"
shift # past argument
shift # past value
;;
-r|--repo)
REPO="$2"
shift # past argument
shift # past value
;;
-i|--issue)
ISSUE="$2"
shift # past argument
shift # past value
;;
-s|--since)
SINCE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
shift # past argument
;;
esac
done
NUMBER=1
RESP=$(curl -s "https://api.github.com/repos/$USER/$REPO/issues/$ISSUE/comments?per_page=100&since=$SINCE&page=$NUMBER" | grep -e login -e created_at -e body | sed 's#"login"#\n"login"#g' | sed 's#\\r\\n#\n\t\t#g')
while [[ $RESP != "" ]]; do
echo "${RESP}"
((++NUMBER))
RESP=$(curl -s "https://api.github.com/repos/$USER/$REPO/issues/$ISSUE/comments?per_page=100&since=$SINCE&page=$NUMBER" | grep -e login -e created_at -e body | sed 's#"login"#\n"login"#g' | sed 's#\\r\\n#\n\t\t#g')
done