Sha256: 32175373e96fe2e78ef38073d2ef02e07f3c1200d0179e94187fb9bec7b1e31f
Contents?: true
Size: 1.97 KB
Versions: 2
Compression:
Stored size: 1.97 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'octokit' require 'soopr.rb' class App include Methadone::Main include Methadone::CLILogging def self.colorize color_code, string if options[:monochrome] string else "\e[#{color_code}m#{string}\e[0m" end end def self.blue string colorize 34, string end def self.green string colorize 32, string end def self.red string colorize 31, string end main do |organisation, team| Octokit.configure do |c| c.netrc = true c.auto_paginate = true end logger.debug "Starting to fetch teams for organisation '#{organisation}'" teams = Octokit.organization_teams organisation team_resource = teams.find{ |t| t.name == team} if team_resource.nil? exit_now! 1, "No team with name '#{team}' could be found" end debug "Starting to fetch repos for team '#{team}'" all_repos = Octokit.team_repositories(team_resource.id) logger.debug "All repos found for team: #{all_repos.map(&:name)}" repos_with_issues = all_repos.select{|r| r.open_issues_count > 0} debug "Repos with open issues: #{repos_with_issues.map(&:name)}" if repos_with_issues.empty? puts green "No open pull requests found." else debug "Open pull requests for '#{team}':" repos_with_issues.each do |repo| pull_requests = Octokit.pull_requests repo.id if pull_requests.size > 0 then puts red "# #{repo.name}" pull_requests.each do |pr| puts blue("- #{pr.title}: ") + green("#{pr.html_url}\n\n") end end end end end version Soopr::VERSION description 'List open pull requests of a Github team' on "-m", "--monochrome", "Use monochrome output instead of colors" arg :organisation, "Github organisation the team belongs to" arg :team, "Github team from which to list open pull requests" use_log_level_option :toggle_debug_on_signal => 'USR1' go! end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
soopr-0.2.1 | bin/soopr |
soopr-0.2.1 | exe/soopr |