lib/wassup/helpers/github.rb in wassup-0.3.2 vs lib/wassup/helpers/github.rb in wassup-0.4.0

- old
+ new

@@ -84,25 +84,30 @@ module Wassup module Helpers module GitHub module Formatter - def self.issue(issue, show_repo: false, show_interactions: false) - self.pr(issue, show_repo: show_repo, show_interactions: show_interactions) + def self.issue(issue, show_repo: false, show_username: false, show_interactions: false) + self.pr(issue, show_repo: show_repo, show_username: show_username, show_interactions: show_interactions) end - def self.pr(pr, show_repo: false, show_interactions: false) + def self.pr(pr, show_repo: false, show_username: false, show_interactions: false) number = pr["number"] title = pr["title"] created_at = pr["created_at"] repo_name = "" if show_repo repo_url_parts = pr["repository_url"].split("/") repo_name = "[fg=gray]#{repo_url_parts.last} " end + username = "" + if show_username + username = "[fg=magenta]#{pr["user"]["login"]} " + end + interactions = "" if show_interactions interaction_count = pr["comments"] + pr["reactions"]["total_count"] interactions = "[fg=red]#{interaction_count} " end @@ -111,10 +116,10 @@ date = Time.parse(created_at) days = (Time.now - date).to_i / (24 * 60 * 60) days_formatted = '%3.3s' % days.to_s - display = "[fg=yellow]#{number_formatted}[fg=cyan] #{days_formatted}d ago #{interactions}#{repo_name}[fg=white]#{title}" + display = "[fg=yellow]#{number_formatted}[fg=cyan] #{days_formatted}d ago #{interactions}#{repo_name}#{username}[fg=white]#{title}" return display end def self.release(release)