aboutsummaryrefslogblamecommitdiffstats
path: root/osurl
blob: 9d68e71f5b6033d1e81971f8e35a3758d18e33c6 (plain) (tree)
























                                                                        
#!/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]))