module PacmanReport
Constants
- FOOTER
- TAG
Public Instance Methods
Source
# File lib/pacman_report.rb, line 76 def build_fetch_error(query) SearchReport.fetch_error_card( tag: TAG, query: query, fallback_title: "package search", error_lines: [ "Arch Linux package search unavailable right now.", "Try: #{PacmanSearch.browse_url(query)}" ], footer_parts: FOOTER ) end
Source
# File lib/pacman_report.rb, line 40 def build_report(query:, total:, items:) if items.empty? return SearchReport.empty_report( tag: TAG, query: query, total: 0, empty_lines: [ "No official repo matches for that keyword.", "Browse: #{PacmanSearch.browse_url(query)}" ], footer_parts: FOOTER ) end extra = total - items.length body_lines = items.each_with_index.map { |item, index| format_item_line(index + 1, item) } body_lines << "... #{TextUtil.format_count(extra)} more in official repos" if extra.positive? SearchReport.results_report( tag: TAG, query: query, total: total, body_lines: body_lines, footer_parts: FOOTER ) end
Source
# File lib/pacman_report.rb, line 67 def build_usage SearchReport.usage_card( tag: TAG, title: "package search", usage_message: PacmanSearch.usage_message, footer_parts: FOOTER ) end
Source
# File lib/pacman_report.rb, line 26 def format_item_line(index, item) meta = [item[:version], format_repo_arch(item)] meta << item[:maintainer].to_s.strip unless item[:maintainer].to_s.strip.empty? meta << "flagged" if item[:flagged] meta << PacmanSearch.truncate_text(item[:description]) SearchReport.list_item_line( index: index, title: item[:name], detail_parts: meta.reject(&:empty?), url: item[:url] ) end
Source
# File lib/pacman_report.rb, line 18 def format_repo_arch(item) repo = item[:repo].to_s.strip arch = item[:arch].to_s.strip return "" if repo.empty? || arch.empty? "#{repo}/#{arch}" end