pull.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
       ---
       pull.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 PULL_CGI="${CGI_BASEDIR}/github/pull.dcgi"
           10 
           11 
           12 case "$2" in
           13 */*/*)
           14         IFS=/ set -- "$2"
           15         set -- $*
           16         owner=$1
           17         repo=$2
           18         pull=$3
           19         ;;
           20 *)
           21         exit 1
           22         ;;
           23 esac
           24 
           25 
           26 url="https://api.github.com/repos/${owner}/${repo}/pulls/${pull}"
           27 curl -Lgs -- "${url}" |
           28     jq -r '
           29     "",
           30     "GitHub - '"${owner}/${repo}"' pull request #'"${pull}"'",
           31     "",
           32     "#\(.number) \(.title)",
           33     "\(.state)   @\(.user.login)   \(.created_at[0:10])",
           34     "[h|patch|URL:\(.patch_url)|server|port]",
           35     "",
           36     "\(.body)",
           37     ""
           38 ' | expand | sed -e '/^\[[0137Ighi]\|/n' -e 's/^/t/'
           39 
           40 url="https://api.github.com/repos/${owner}/${repo}/pulls/${pull}/comments"
           41 curl -s "${url}" |
           42     jq -r '
           43     .[] |
           44         "@\(.user.login) writes:",
           45         "\(.body)",
           46         ""
           47 ' | expand | sed -e '/^\[[0137Ighi]\|/n' -e 's/^/t/'