From a00a52cfb79829b80386e8d43249cd94df63c57e Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 25 Oct 2024 15:13:31 +0200 Subject: chore: rename shell scripts to *.sh --- osurl.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 osurl.sh (limited to 'osurl.sh') diff --git a/osurl.sh b/osurl.sh new file mode 100755 index 0000000..a7c9f15 --- /dev/null +++ b/osurl.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# Expand abbreviations from +# https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Current_set_of_abbreviations +set -eu + +if [ $# -lt 1 ] ; then +STR="$(cat)" +else +STR="$1" +fi + +STR="$(echo "$STR" | sed -E -e 's@bgo[#-]([0-9])@https://bugzilla.gnome.org/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@bpo[#-]([0-9])@https://bugs.python.org/issue\1@')" +STR="$(echo "$STR" | sed -E -e 's@bko[#-]([0-9])@https://bugzilla.kernel.org/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@bmo[#-]([0-9])@https://bugzilla.mozilla.org/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@boo[#-]([0-9])@https://bugzilla.opensuse.org/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@bnc[#-]([0-9])@https://bugzilla.novell.com/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@bsc[#-]([0-9])@https://bugzilla.suse.com/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@bds[#-]([0-9])@https://build.suse.de/request/show/\1@')" +STR="$(echo "$STR" | sed -E -e 's@isr[#-]([0-9])@https://build.suse.de/request/show/\1@')" +STR="$(echo "$STR" | sed -E -e 's@ssr[#-]([0-9])@https://build.suse.de/request/show/\1@')" +STR="$(echo "$STR" | sed -E -e 's@bdo[#-]([0-9])@https://build.opensuse.org/request/show/\1@')" +STR="$(echo "$STR" | sed -E -e 's@sr[#-]([0-9])@https://build.opensuse.org/request/show/\1@')" +STR="$(echo "$STR" | sed -E -e 's@jsc[#-](\S+)@https://jira.suse.com/browse/\1@')" +STR="$(echo "$STR" | sed -E -e 's@gh[#-]([^#]*)[#-]([0-9]+)@https://github.com/\1/issues/\2@')" +STR="$(echo "$STR" | sed -E -e 's!gh[#-]([^#]*)@(\S+)!https://github.com/\1/commit/\2!')" +STR="$(echo "$STR" | sed -E -e 's@gh[#-]([^#]*)!(\S+)@https://github.com/\1/pull/\2@')" +# Python exception +STR="$(echo "$STR" | sed -E -e 's@gh[#-]([0-9]+)[: ]*@https://github.com/python/cpython/issues/\1@I')" +STR="$(echo "$STR" | sed -E -e 's@gh[#-]([^#]*)\$(\S+)@https://github.com/\1/discussions/\2@')" +STR="$(echo "$STR" | sed -E -e 's@gl[#-]([^#]*)[#-](\S+)@https://gitlab.com/\1/issues/\2@')" +STR="$(echo "$STR" | sed -E -e 's@gl[#-]([^#]*)!(\S+)@https://gitlab.com/\1/-/merge_requests/\2@')" +STR="$(echo "$STR" | sed -E -e 's@bt[#-]([^#]*)[#-](\S+)@https://bitbucket.org/\1/issues/\2@')" +STR="$(echo "$STR" | sed -E -e 's@glfo[#-]([^#]*)[#-](\S+)@https://gitlab.freedesktop.org/\1/issues/\2@')" +STR="$(echo "$STR" | sed -E -e 's@glgo[#-]([^#]*)[#-](\S+)@https://gitlab.gnome.org/\1/issues/\2@')" +STR="$(echo "$STR" | sed -E -e 's@coo[#-]([^#]*)[#-](\S+)@https://code.opensuse.org/\1/issue/\2@')" +STR="$(echo "$STR" | sed -E -e 's@code-o-o[#-]([^#]*)[#-](\S+)@https://code.opensuse.org/\1/issue/\2@')" +STR="$(echo "$STR" | sed -E -e 's@srht[#-]([^#]*)[#-](\S+)@https://todo.sr.ht/~\1/\2@')" +STR="$(echo "$STR" | sed -E -e 's@sh[#-]([0-9]+)@http://sourceforge.net/support/tracker.php?aid=\1@')" +STR="$(echo "$STR" | sed -E -e 's@shb[#-](.*)[#-]([0-9]+)@https://sourceforge.net/p/\1/bugs/\2/@')" +STR="$(echo "$STR" | sed -E -e 's@shp[#-](.*)[#-]([0-9]+)@https://sourceforge.net/p/\1/patches/\2/@')" +STR="$(echo "$STR" | sed -E -e 's@sht[#-](.*)[#-]([0-9]+)@https://sourceforge.net/p/\1/tickets/\2/@')" +STR="$(echo "$STR" | sed -E -e 's@lp[#-]([0-9]+)@https://launchpad.net/bugs/\1@')" +STR="$(echo "$STR" | sed -E -e 's@rh[#-]([0-9]+)@https://bugzilla.redhat.com/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@rhbz[#-]([0-9]+)@https://bugzilla.redhat.com/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@tdf[#-]([0-9]+)@https://bugs.documentfoundation.org/show_bug.cgi?id=\1@')" +STR="$(echo "$STR" | sed -E -e 's@pep[#-]([0-9]+)@https://www.python.org/dev/peps/pep-\1@')" +STR="$(echo "$STR" | sed -E -e 's@ffn[#-]([0-9]+)@https://www.fanfiction.net/s/\1@')" +STR="$(echo "$STR" | sed -E -e 's@ao3[#-]([0-9]+)@https://archiveofourown.org/works/\1@')" +STR="$(echo "$STR" | sed -E -e 's@boost[#-]([0-9]+)@https://svn.boost.org/trac/boost/\1@')" +STR="$(echo "$STR" | sed -E -e 's@RT[#-]([0-9]+)@https://rt.cpan.org/Public/\1@')" +STR="$(echo "$STR" | sed -E -e 's@deb[#-]([0-9]+)@https://bugs.debian.org/\1@')" +STR="$(echo "$STR" | sed -E -e 's@fdo[#-]([0-9]+)@https://bugs.freedesktop.org/\1@')" +STR="$(echo "$STR" | sed -E -e 's@gcc[#-]([0-9]+)@https://gcc.gnu.org/bugzilla/\1@')" +STR="$(echo "$STR" | sed -E -e 's@kde[#-]([0-9]+)@https://bugs.kde.org/\1@')" +STR="$(echo "$STR" | sed -E -e 's@obs[#-]([0-9]+)@https://api.github.com/repos/openSUSE/open-build-service/issues/\1@')" +STR="$(echo "$STR" | sed -E -e 's@build[#-]([0-9]+)@https://api.github.com/repos/openSUSE/obs-build/issues/\1@')" +STR="$(echo "$STR" | sed -E -e 's@osc[#-]([0-9]+)@https://api.github.com/repos/openSUSE/osc/issues/\1@')" +STR="$(echo "$STR" | sed -E -e 's@poo[#-]([0-9]+)@https://progress.opensuse.org/issues/\1@')" +STR="$(echo "$STR" | sed -E -e 's@lf[#-]([0-9]+)@https://developerbugs.linux-foundation.org/\1@')" +STR="$(echo "$STR" | sed -E -e 's@cve[#-]([0-9-]+)@https://cve.mitre.org/cgi-bin/cvename.cgi?name=\1@I')" + +OPEN_UTIL="xdg-open" +type flatpak-xdg-open >/dev/null 2>/dev/null && OPEN_UTIL="flatpak-xdg-open" +setsid $OPEN_UTIL "$STR" -- cgit