diff options
Diffstat (limited to 'osurl')
-rwxr-xr-x | osurl | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +#!/usr/bin/lua + +local function expAbbr(instr) + local patterns = { + ["bgo#(%d+)"]="http://bugzilla.gnome.org/show_bug.cgi?id=%1", + ["bko#(%d+)"]="http://bugzilla.kernel.org/show_bug.cgi?id=%1", + ["bmo#(%d+)"]="http://bugzilla.mozilla.org/show_bug.cgi?id=%1", + ["boo#(%d+)"]="http://bugzilla.opensuse.org/show_bug.cgi?id=%1", + ["bsc#(%d+)"]="http://bugzilla.suse.com/show_bug.cgi?id=%1", + ["bnc#(%d+)"]="http://bugzilla.novell.com/show_bug.cgi?id=%1", + ["gh#([^#]+)#(%w+)"]="https://github.com/%1/issues/%2", + ["lp#(%d+)"]="https://launchpad.net/bugs/%1", + ["rh#(%d+)"]="http://bugzilla.redhat.com/show_bug.cgi?id=%1", + } + + for pat, repl in pairs(patterns) do + local newurl, res = string.gsub(instr, pat, repl) + if res == 1 then + return newurl + end + end + return instr +end + +os.execute("xdg-open " .. expAbbr(arg[1])) |