issue.dcgi - gophercgis - Collection of gopher CGI/DCGI for geomyidae
(HTM) hg clone https://bitbucket.org/iamleot/gophercgis
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
issue.dcgi
---
1 #!/bin/sh
2
3 . ../common/config.sh
4
5 ISSUE_CGI="${CGI_BASEDIR}/github/issue.dcgi"
6 ISSUES_CGI="${CGI_BASEDIR}/github/issues.dcgi"
7 COMMITS_CGI="${CGI_BASEDIR}/github/commits.dcgi"
8 PULLS_CGI="${CGI_BASEDIR}/github/pulls.dcgi"
9
10
11 case "$2" in
12 */*/*)
13 IFS=/ set -- "$2"
14 set -- $*
15 owner=$1
16 repo=$2
17 issue=$3
18 ;;
19 *)
20 exit 1
21 ;;
22 esac
23
24
25 url="https://api.github.com/repos/${owner}/${repo}/issues/${issue}"
26 curl -Lgs -- "${url}" |
27 jq -r '
28 "",
29 "GitHub - '"${owner}/${repo}"' issue #'"${issue}"'",
30 "",
31 "#\(.number) \(.title)",
32 "\(.state) @\(.user.login) \(.created_at[0:10])",
33 "",
34 "\(.body)",
35 ""
36 ' | expand | sed -e '/^\[[0137Ighi]\|/n' -e 's/^/t/'
37
38 url="https://api.github.com/repos/${owner}/${repo}/issues/${issue}/comments"
39 curl -s "${url}" |
40 jq -r '
41 .[] |
42 "@\(.user.login) writes:",
43 "\(.body)",
44 ""
45 ' | expand | sed -e '/^\[[0137Ighi]\|/n' -e 's/^/t/'