aboutsummaryrefslogtreecommitdiffstats
path: root/osurl
blob: 2deb7534d3b2322c21974a518cc9d09c06c9a174 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/luajit

local lpeg = require 'lpeg'
local P,C,Cs,R = lpeg.P, lpeg.C, lpeg.Cs, lpeg.R

local cnum = C(R("09")^1)
local cword = C(R("AZ","az","09","__")^1)
local bugpat =
	  (P"bgo#" * cnum) / "http://bugzilla.gnome.org/show_bug.cgi?id=%1"
	+ (P"bko#" * cnum) / "http://bugzilla.kernel.org/show_bug.cgi?id=%1"
	+ (P"bmo#" * cnum) / "http://bugzilla.mozilla.org/show_bug.cgi?id=%1"
	+ (P"boo#" * cnum) / "http://bugzilla.opensuse.org/show_bug.cgi?id=%1"
	+ (P"bsc#" * cnum) / "http://bugzilla.suse.com/show_bug.cgi?id=%1"
	+ (P"gh#" * C((1 - P"#")^1) * P"#" * cword) / "https://github.com/%1/issues/%2"
	+ (P"lp#" * cnum) / "https://launchpad.net/bugs/%1"
	+ (P"rh#" * cnum) / "http://bugzilla.redhat.com/show_bug.cgi?id=%1"
local pat = Cs((bugpat + P(1))^0)

os.execute("xdg-open " .. pat:match(arg[1]))