add motd generator script
[freebsd-maintainer-scripts/.git] / ftabs.py
CommitLineData
03ee5aac
SB
1#!/usr/bin/env python
2
3import os
4import webbrowser
5import sys
6
7username = os.environ.get('USER') or 'sbz'
8g_label = "freebsd/freebsd-{}".format(username)
9g_link = "https://mail.google.com/mail/u/0/?tab=wm#label/{}".format(g_label)
10out_link = "http://portscout.freebsd.org/{}@freebsd.org.html".format(username)
11bts_args = "?email1={}%40FreeBSD.org&order=changeddate&resolution=---"
12bts_args = bts_args.format(username)
13bts_link = "https://bugs.freebsd.org/bugzilla/buglist.cgi{}"
11137c24 14repo_link = "https://repology.org/maintainer/{}%40freebsd.org".format(username)
03ee5aac
SB
15
16
17class URL(object):
18 def __init__(self, **kwargs):
19 self.link = kwargs.get("link")
20 self.desc = kwargs.get("desc", "N/A")
21 self.abrv = kwargs.get("abrv", "N/A")
22
23 def link(self):
24 return self.link
25
26 def desc(self):
27 return self.desc
28
29 def abrv(self):
30 return self.abrv.upper()
31
32URLS = [
33 URL(link="https://reviews.freebsd.org/", desc="code review", abrv="cr"),
34 URL(link=bts_link.format(bts_args), desc="bug tracking", abrv="bts"),
35 URL(link="https://github.com/freebsd/", desc="github", abrv="gh"),
36 URL(link="https://svnweb.freebsd.org/", desc="code browser", abrv="cb"),
37 URL(link=out_link, desc="portcout", abrv="pc"),
11137c24 38 URL(link=repo_link, desc="repology", abrv="rl"),
03ee5aac
SB
39 URL(link=g_link, desc="freebsd-{}".format(username), abrv="gmail"),
40 URL(link="https://wiki.freebsd.org", desc="wiki", abrv="wk"),
41 URL(link="http://beefy6.nyi.freebsd.org/", desc="builder status",
42 abrv="build"),
43 URL(link="https://secure.freshbsd.org/search?project=freebsd",
44 desc="commit stats", abrv="stats"),
45 URL(link="http://grok.dragonflybsd.org/source/xref/freebsd/",
46 desc="xref browser", abrv="xref"),
47]
48
49
50def main():
51 rc = 1
52 browser = webbrowser.get()
53 for url in URLS:
54 ret = browser.open_new_tab(url.link)
55 if ret is False: # cannot open the link, try next one
56 rc = 0
57 continue
58
59 return rc
60
61if __name__ == "__main__":
62 sys.exit(main())