Colour the state of a pull request

This commit is contained in:
jesopo 2019-03-02 08:38:56 +00:00
parent c45fcb34d1
commit e4a4b193fe

View file

@ -142,6 +142,19 @@ class Module(ModuleManager.BaseModule):
removed = self._removed(page.data["deletions"]) removed = self._removed(page.data["deletions"])
url = self._short_url(page.data["html_url"]) 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( event["stdout"].write(
"(%s pull#%s, %s) %s%s [%s/%s] %s %s" % ( "(%s pull#%s, %s) %s%s [%s/%s] %s %s" % (
repo, number, page.data["state"], branch_from, branch_to, repo, number, page.data["state"], branch_from, branch_to,