Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markdown format output to bodhi plugin #333

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions did/plugins/bodhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,20 @@ def search(self, query):
class Update(object):
""" Bodhi update """

def __init__(self, data):
def __init__(self, data, format):
self.data = data
self.format = format
self.title = data['title']
self.project = data['release']['name']
self.identifier = data['alias']
self.created = data['date_submitted']
self.url = data['url']
log.details('[{0}] {1}'.format(self.created, self))

def __str__(self):
""" String representation """
if self.format == "markdown":
return f'[{self.identifier}]({self.url}) - {self.title} [{self.project}]'
return f'{self.identifier} - {self.title} [{self.project}]'


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