Add GitHub DCGI for repository and issues of a repository. - 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
---
(DIR) changeset 8efcd5dbbb1b5c7968a7938abd208ff6d76dfb84
(DIR) parent 82cb3fdad8fbc5771bc23e69df4606e11ce5e153
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Fri, 31 Aug 2018 10:09:59
Add GitHub DCGI for repository and issues of a repository.
Still experimental and incomplete, beware!
Diffstat:
github/issues.dcgi | 33 +++++++++++++++++++++++++++++++++
github/repo.dcgi | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)
---
diff -r 82cb3fdad8fb -r 8efcd5dbbb1b github/issues.dcgi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/github/issues.dcgi Fri Aug 31 10:09:59 2018 +0200
@@ -0,0 +1,33 @@
+#!/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
+*/*)
+ owner=${2%%/*}
+ repo=${2##*/}
+ ;;
+*)
+ exit 1
+ ;;
+esac
+
+
+url="https://api.github.com/repos/${owner}/${repo}/issues"
+/usr/pkg/bin/curl -s "${url}" |
+ /usr/pkg/bin/jq -r '
+ "t",
+ "tGitHub - '"${owner}/${repo}"' issues",
+ "t",
+ ( .[] |
+ "[1|#\(.number) \(.title | gsub("\\|"; "\\|"))|" +
+ "'"${ISSUE_CGI}?${owner}/${repo}/"'\(.number)|server|port]",
+ "t@\(.user.login)",
+ "t"
+ )
+'
diff -r 82cb3fdad8fb -r 8efcd5dbbb1b github/repo.dcgi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/github/repo.dcgi Fri Aug 31 10:09:59 2018 +0200
@@ -0,0 +1,42 @@
+#!/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
+*/*)
+ owner=${2%%/*}
+ repo=${2##*/}
+ ;;
+*)
+ exit 1
+ ;;
+esac
+
+
+url="https://api.github.com/repos/${owner}/${repo}"
+/usr/pkg/bin/curl -s "${url}" |
+ /usr/pkg/bin/jq -r '
+ "t",
+ "tGitHub - \(.full_name)",
+ "t",
+ "[h|Homepage|URL:\(.homepage)|server|port]",
+ "t",
+ "t\(.name) - \(.description)",
+ "t",
+ "tStargazers: \(.stargazers_count)",
+ "tSubscribers: \(.subscribers_count)",
+ "t",
+ "[1|Issues|'"${ISSUES_CGI}?${owner}/${repo}"'|server|port]",
+ "[1|Pull requests|'"${PULLREQUESTS_CGI}?${owner}/${repo}"'|server|port]",
+ "[1|Commits|'"${COMMITS_CGI}?${owner}/${repo}"'|server|port]",
+ "t",
+ "[h|Clone (HTTP)|URL:\(.clone_url)|server|port]",
+ "[h|Clone (Git)|URL:\(.git_url)|server|port]",
+ "[h|Clone (SSH)|URL:\(.ssh_url)|server|port]",
+ "t"
+'