From e4a4b193fe17e675ba4498490c9c882462498490 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 2 Mar 2019 08:38:56 +0000 Subject: Colour the state of a pull request --- modules/github/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'modules/github/__init__.py') diff --git a/modules/github/__init__.py b/modules/github/__init__.py index c43b5c67..7498950f 100644 --- a/modules/github/__init__.py +++ b/modules/github/__init__.py @@ -142,6 +142,19 @@ class Module(ModuleManager.BaseModule): removed = self._removed(page.data["deletions"]) url = self._short_url(page.data["html_url"]) + state = page.data["state"] + state_color = None + if page.data["merged"]: + state = "merged" + state_color = utils.consts.GREEN + elif state == "open": + state_color = utils.consts.GREEN + elif state == "closed": + state_color = utils.consts.RED + + if state_color: + state = utils.irc.color(state, state_color) + event["stdout"].write( "(%s pull#%s, %s) %s → %s [%s/%s] %s %s" % ( repo, number, page.data["state"], branch_from, branch_to, -- cgit v1.3.1-10-gc9f91