Hello Lucas, I discovered this tool at the Mini-DebConf and really like it, it is really more convenient to get the bug's url directly when you upgrade.
Thank you for this little tool, it is already really helpfull to me. I read the script, and feel that it is not to hard to implement some fancy color in the output, so I done a fast and simple implementation. WNPP : red GIFT : green NOTESTING : blue AUTOREMOVAL : cyan It can add a method, for managing the output and coloring it (or not), if a option is given. Regards, Guillaume Seren.
--- how-can-i-help-3/bin/how-can-i-help 2014-01-19 10:54:37.000000000 +0100 +++ /home/gseren/how-can-i-help 2014-01-20 22:45:02.752114000 +0100 @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +# require require 'pp' require 'debian' require 'net/http' @@ -26,6 +27,29 @@ require 'fileutils' require 'time' +# Some color for the output +class String + def black; "\033[30m#{self}\033[0m" end + def red; "\033[31m#{self}\033[0m" end + def green; "\033[32m#{self}\033[0m" end + def brown; "\033[33m#{self}\033[0m" end + def blue; "\033[34m#{self}\033[0m" end + def magenta; "\033[35m#{self}\033[0m" end + def cyan; "\033[36m#{self}\033[0m" end + def gray; "\033[37m#{self}\033[0m" end + def bg_black; "\033[40m#{self}\033[0m" end + def bg_red; "\033[41m#{self}\033[0m" end + def bg_green; "\033[42m#{self}\033[0m" end + def bg_brown; "\033[43m#{self}\033[0m" end + def bg_blue; "\033[44m#{self}\033[0m" end + def bg_magenta; "\033[45m#{self}\033[0m" end + def bg_cyan; "\033[46m#{self}\033[0m" end + def bg_gray; "\033[47m#{self}\033[0m" end + def bold; "\033[1m#{self}\033[22m" end + def reverse_color; "\033[7m#{self}\033[27m" end +end + +# Define HOME=ENV['HOME'] HELPITEMS_URL = 'http://udd.debian.org/how-can-i-help.json.gz' CACHEDIR = "#{HOME}/.cache/how-can-i-help" @@ -34,12 +58,13 @@ CACHE = "#{CACHEDIR}/how-can-i-help.json.gz" PACKAGES = "#{CONFIGDIR}/packages" +# Include include Debian $quiet = false $all = false $proxy_url = ENV["HTTP_PROXY"] || ENV["http_proxy"] - +# Parsing arg optparse = OptionParser.new do |opts| opts.on('-h', '--help', 'show help') do puts opts @@ -178,21 +203,21 @@ if wnpp.length > 0 puts $all ? 'Packages where help is needed, including orphaned ones (from WNPP):' : 'New packages where help is needed, including orphaned ones (from WNPP):' wnpp.sort { |a, b| wnppcompare(a,b) }.each do |r| - puts " - #{r['source']} - http://bugs.debian.org/#{r['wnppbug']} - #{wnpptype(r['wnpptype'])}" + puts " - #{r['source']} - http://bugs.debian.org/#{r['wnppbug']} - #{wnpptype(r['wnpptype'])}".red end end if gift.length > 0 puts $all ? 'Bugs suitable for new contributors (tagged \'gift\'):' : 'New bugs suitable for new contributors (tagged \'gift\'):' gift.sort { |a, b| [a['package'], a['bug'] ] <=> [ b['package'], b['bug'] ] }.each do |r| - puts " - #{r['package']} - http://bugs.debian.org/#{r['bug']} - #{r['title']}" + puts " - #{r['package']} - http://bugs.debian.org/#{r['bug']} - #{r['title']}".green end end if notesting.length > 0 puts $all ? 'Packages removed from Debian \'testing\' (the maintainer might need help):' : 'New packages removed from Debian \'testing\' (the maintainer might need help):' notesting.sort { |a, b| a['source'] <=> b['source'] }.each do |r| - puts " - #{r['package']} - http://packages.qa.debian.org/#{r['source']}" + puts " - #{r['package']} - http://packages.qa.debian.org/#{r['source']}".blue end end @@ -207,7 +232,7 @@ else bugs = " (bug: #{bugs[0]})" end - puts " - #{r['source']} - http://packages.qa.debian.org/#{r['source']} - removal on #{Time.at(r['removal_time']).to_date.to_s}#{bugs}" + puts " - #{r['source']} - http://packages.qa.debian.org/#{r['source']} - removal on #{Time.at(r['removal_time']).to_date.to_s}#{bugs}".cyan end end