commit d746cf7ca6548060f2cf0d607592421f3db78b2f
parent 783ccf81be2d4b6bedb4910503bcd6b987587a7d
Author: William Casarin <jb55@jb55.com>
Date: Mon, 13 Dec 2021 08:52:22 -0800
prpatch
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/bin/github-project-slug b/bin/github-project-slug
@@ -0,0 +1,2 @@
+#!/bin/sh
+<<<"$PWD" sed -En 's,.*github/([^/]+)/([^/[:space:]]+)(/.*)?$,\1/\2,p'
diff --git a/bin/prpatch b/bin/prpatch
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -eou pipefail
+
+if [ -z "$1" ]; then
+ printf "usage: prpatch <id> [owner/project]\n"
+ exit 1
+fi
+
+project=${2:-$(github-project-slug)}
+id="$1"
+
+curl -sL "https://github.com/${project}/pull/${id}.patch"