commit b4e0f77ae9ce39bf3bdf141cb74df7467f86b00a (patch) parent 4aad3e292d9b34bad85c8f0294796f90036dcbbc Author: Alex Karle <alex@alexkarle.com> Date: Mon, 12 Sep 2022 17:56:57 -0400 acme: Add :Gbrowse clone to open file as URL for sharing Diffstat:
A | bin/acme-scripts/Gbrowse | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/bin/acme-scripts/Gbrowse b/bin/acme-scripts/Gbrowse @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +REPO=$(git rev-parse --show-toplevel) +[ -z "$REPO" ] && exit 1 +FILE=${1:-$(readlink -f $samfile)} +resource=${FILE##$REPO/} +url=$(git remote get-url origin | sed -e 's/^git@//' -e 's@:@/@' -e 's/\.git$//') +${BROWSER:-firefox} "https://$url/blob/master/$resource"