Skip to content

Commit 014a793

Browse files
sandrobonazzolapsss
authored andcommitted
Add markdown format output to bodhi plugin
Signed-off-by: Sandro Bonazzola <[email protected]>
1 parent 6f9b68d commit 014a793

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

did/plugins/bodhi.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,20 @@ def search(self, query):
5858
class Update(object):
5959
""" Bodhi update """
6060

61-
def __init__(self, data):
61+
def __init__(self, data, format):
6262
self.data = data
63+
self.format = format
6364
self.title = data['title']
6465
self.project = data['release']['name']
6566
self.identifier = data['alias']
6667
self.created = data['date_submitted']
68+
self.url = data['url']
6769
log.details('[{0}] {1}'.format(self.created, self))
6870

6971
def __str__(self):
7072
""" String representation """
73+
if self.format == "markdown":
74+
return f'[{self.identifier}]({self.url}) - {self.title} [{self.project}]'
7175
return f'{self.identifier} - {self.title} [{self.project}]'
7276

7377

@@ -81,7 +85,8 @@ class UpdatesCreated(Stats):
8185
def fetch(self):
8286
log.info('Searching for updates created by {0}'.format(self.user))
8387
self.stats = [
84-
Update(update) for update in self.parent.bodhi.search(
88+
Update(update, self.parent.options.format)
89+
for update in self.parent.bodhi.search(
8590
query='updates/?user={0}&submitted_before={1}'
8691
'&submitted_since={2}'.format(
8792
self.user.login, self.options.until.date,

0 commit comments

Comments
 (0)