From a063f54a3840bf42712a8f4321f33d49c744ef63 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 2 Mar 2019 21:14:51 +0000 Subject: [PATCH] Don't show "[]" when there are no labels in !ghissue --- modules/github/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/github/__init__.py b/modules/github/__init__.py index 6298a3a1..79895f57 100644 --- a/modules/github/__init__.py +++ b/modules/github/__init__.py @@ -109,11 +109,15 @@ class Module(ModuleManager.BaseModule): def _gh_issue(self, event, page, username, repository, number): labels = [label["name"] for label in page.data["labels"]] + labels_str = "" + if labels: + labels_str = "[%s] " % ", ".join(labels) + url = self._short_url(page.data["html_url"]) - event["stdout"].write("(%s/%s issue#%s, %s) %s [%s] %s" % ( + event["stdout"].write("(%s/%s issue#%s, %s) %s %s%s" % ( username, repository, number, page.data["state"], - page.data["title"], ", ".join(labels), url)) + page.data["title"], labels_str, url)) def _gh_get_issue(self, username, repository, number): return utils.http.request( API_ISSUE_URL % (username, repository, number),