mail-prpatch-demo (275B)
1 #!/usr/bin/env bash 2 3 set -eou pipefail 4 5 prpatch() { 6 id="$1" 7 project="$2" 8 curl -sL "https://github.com/${project}/pull/${id}.patch" 9 } 10 11 args=$( 12 grep -E 'github\.com.*pull/' | 13 head -n1 | 14 sed -En 's,.*github.com/([^/]+)/([^/]+)/pull/([0-9]+).*,\3 \1/\2,p' 15 ) 16 17 prpatch $args