From cad5a05f2c26baa010e88749b5c52ee0fbf97a1b Mon Sep 17 00:00:00 2001 From: Ricardo Branco Date: Thu, 7 Sep 2023 07:55:28 +0200 Subject: [PATCH] Add terminator plugin --- Makefile | 2 +- README.md | 4 +++ terminator.py | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 terminator.py diff --git a/Makefile b/Makefile index d6faf64..d418532 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -FILES=*.py +FILES=bugme.py .PHONY: all all: flake8 pylint diff --git a/README.md b/README.md index 2333f3e..94a92f5 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ gh#19529 closed Tue Aug 08 10:56:56 CEST 2023 Unexpected error poo#133910 Resolved Thu Aug 17 08:50:53 CEST 2023 We need a suite of tests to check volume operations in container runtimes ``` +## Terminator plugin + +Copy [terminator.py](terminator.py) to `~/.config/terminator/plugins/` + ## Requirements - Tested on Python 3.8+ diff --git a/terminator.py b/terminator.py new file mode 100644 index 0000000..a1c400a --- /dev/null +++ b/terminator.py @@ -0,0 +1,75 @@ +""" +Plugin for terminator + +Copy this file to $HOME/.config/terminator/plugins/ + +Based on: +https://terminator-gtk3.readthedocs.io/en/latest/plugins.html +""" + +import re +import terminatorlib.plugin as plugin + +AVAILABLE = ['cve', 'suse_bugzilla', 'suse_jira', 'suse_incident', 'suse_fate', 'suse_progress'] + + +class base(plugin.URLHandler): + capabilities = ['url_handler'] + + def callback(self, line): + for item in re.findall(self._extract, line): + return self._url + item + + +class cve(base): + handler_name = 'cve' + match = r'\bCVE-[0-9]+-[0-9]+\b' + nameopen = "Open CVE item" + namecopy = "Copy CVE URL" + _extract = '[0-9]+-[0-9]+' + _url = 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=' + + +class suse_bugzilla(base): + handler_name = 'suse_bugzilla' + match = r'\b(bsc|bnc|boo)#[0-9]+\b' + nameopen = "Open Bugzilla item" + namecopy = "Copy Bugzilla URL" + _extract = '[0-9]+' + _url = 'https://bugzilla.suse.com/show_bug.cgi?id=' + + +class suse_jira(base): + handler_name = 'suse_jira' + match = r'\bjsc#[A-Z]+-[0-9]+\b' + nameopen = "Open Jira item" + namecopy = "Copy Jira URL" + _extract = '[A-Z]+-[0-9]+' + _url = 'https://jira.suse.com/browse/' + + +class suse_incident(base): + handler_name = 'suse_incident' + match = r'\bS(USE)?:M(aintenance)?:[0-9]+:[0-9]+\b' + nameopen = "Open Incident item" + namecopy = "Copy Incident URL" + _extract = '[0-9]+' + _url = 'https://smelt.suse.de/incident/' + + +class suse_fate(base): + handler_name = 'suse_fate' + match = r'\bFATE:[0-9]+\b' + nameopen = "Open FATE item" + namecopy = "Copy FATE URL" + _extract = '[0-9]+' + _url = 'https://fate.suse.com/' + + +class suse_progress(base): + handler_name = 'suse_progress' + match = r'\bpoo#[0-9]+\b' + nameopen = "Open POO item" + namecopy = "Copy POO URL" + _extract = '[0-9]+' + _url = 'https://progress.opensuse.org/issues/'