aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2020-06-11 19:40:06 +0000
committerrodri <rgl@antares-labs.eu>2020-06-11 19:40:06 +0000
commitb6358a184b7a217d1fc163ec492f42a188eee5de (patch)
tree246a8ae4d3be4cd2e51b6df44a5c5c0e3357895f
downloadgithub9-b6358a184b7a217d1fc163ec492f42a188eee5de.tar.gz
github9-b6358a184b7a217d1fc163ec492f42a188eee5de.tar.bz2
github9-b6358a184b7a217d1fc163ec492f42a188eee5de.zip
initial commit.
-rwxr-xr-xcreate18
-rwxr-xr-xdelete16
-rwxr-xr-xgh26
-rwxr-xr-xlist2
-rw-r--r--readme.md10
5 files changed, 72 insertions, 0 deletions
diff --git a/create b/create
new file mode 100755
index 0000000..438d341
--- /dev/null
+++ b/create
@@ -0,0 +1,18 @@
+#!/bin/rc
+repo=()
+desc=()
+
+fn usage {
+ echo usage: $0 name description >[1=2]
+ exit usage
+}
+
+if(! ~ $#* 2)
+ usage
+
+repo=$1
+desc=$2
+
+gh/gh POST /user/repos <<EOF
+{"name": "$repo", "description": "$desc"}
+EOF
diff --git a/delete b/delete
new file mode 100755
index 0000000..679f72a
--- /dev/null
+++ b/delete
@@ -0,0 +1,16 @@
+#!/bin/rc
+user=()
+repo=()
+
+fn usage {
+ echo usage: $0 user repo >[1=2]
+ exit usage
+}
+
+if(! ~ $#* 2)
+ usage()
+
+user=$1
+repo=$2
+
+gh/gh DELETE /repos/$user/$repo
diff --git a/gh b/gh
new file mode 100755
index 0000000..dede3ae
--- /dev/null
+++ b/gh
@@ -0,0 +1,26 @@
+#!/bin/rc
+rfork ne
+token=YOUR_TOKEN_HERE
+method=()
+url=()
+data=()
+
+fn usage {
+ echo usage: gh method url >[1=2]
+ exit usage
+}
+
+if(! ~ $#* 2)
+ usage
+
+method=$1
+url=$2
+if(~ $method POST PUT){
+# echo enter the data:
+# data=`{{echo holdon >[1=3]; cat /dev/cons}>[3]/dev/consctl}
+ data=`{read -m}
+}
+
+hget -m $method -r 'Authorization: token '^$token\
+ -p $"data\
+ https://api.github.com^$url
diff --git a/list b/list
new file mode 100755
index 0000000..483e673
--- /dev/null
+++ b/list
@@ -0,0 +1,2 @@
+#!/bin/rc
+gh/gh GET /user/repos
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..4a3b7a8
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,10 @@
+# GitHub API tools for Plan 9
+
+These tools provide a direct interface to GitHub's v3 API. Their
+purpose is ease of use and practicality for somewhat "heavy" GitHub
+users residing in plan 9(front) systems that want to avoid the webshit
+interface.
+
+Read the code and fill-in your token in `gh`, then install.
+
+I'll provide some examples and a manpage once I'm done with them.