Add an issue DCGI to print the body of the issue and all its comments - gophercgis - Collection of gopher CGI/DCGI for geomyidae
HTML hg clone https://bitbucket.org/iamleot/gophercgis
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR changeset 209bedd2b608dffe01c5aaef7515237865387c19
DIR parent 1a464e93b17faa9975ad50cc9066a27fabe4c31d
HTML Author: Leonardo Taccari <iamleot@gmail.com>
Date: Fri, 31 Aug 2018 12:46:30
Add an issue DCGI to print the body of the issue and all its comments
Diffstat:
github/issue.dcgi | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff -r 1a464e93b17f -r 209bedd2b608 github/issue.dcgi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/github/issue.dcgi Fri Aug 31 12:46:30 2018 +0200
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+
+ISSUE_CGI="/cgi/github/issue.dcgi"
+ISSUES_CGI="/cgi/github/issues.dcgi"
+COMMITS_CGI="/cgi/github/commits.dcgi"
+PULLREQUESTS_CGI="/cgi/github/pullrequests.dcgi"
+
+
+case "$2" in
+*/*/*)
+ IFS=/ set -- "$2"
+ set -- $*
+ owner=$1
+ repo=$2
+ issue=$3
+ ;;
+*)
+ exit 1
+ ;;
+esac
+
+
+url="https://api.github.com/repos/${owner}/${repo}/issues/${issue}"
+/usr/pkg/bin/curl -s "${url}" |
+ /usr/pkg/bin/jq -r '
+ "",
+ "GitHub - '"${owner}/${repo}"' issue #'"${issue}"'",
+ "",
+ "#\(.number) \(.title)",
+ "\(.state) @\(.user.login) \(.created_at[0:10])",
+ "",
+ "\(.body)",
+ ""
+' | sed -e '/^\[[0137Ighi]\|/n' -e 's/^/t/'
+
+url="https://api.github.com/repos/${owner}/${repo}/issues/${issue}/comments"
+/usr/pkg/bin/curl -s "${url}" |
+ /usr/pkg/bin/jq -r '
+ .[] |
+ "@\(.user.login) writes:",
+ "\(.body)",
+ ""
+' | sed -e '/^\[[0137Ighi]\|/n' -e 's/^/t/'