module Fontist::Import::ImportDisplay
Unified progress display for all import commands
Provides consistent, professional Paint-colored output with emojis across Google, SIL, and macOS importers.
Public Class Methods
Source
# File lib/fontist/import/import_display.rb, line 144 def self.debug_info(message) Fontist.ui.say(" #{Paint[message, :black, :bright]}") end
Display debug/info message in gray bold (like macOS import)
@param message [String] Debug message
Source
# File lib/fontist/import/import_display.rb, line 158 def self.download_url(url) Fontist.ui.say(" #{Paint['📥', :green]} Download URL: #{Paint[url, :white]}") end
Display download URL
@param url [String] Download URL
Source
# File lib/fontist/import/import_display.rb, line 130 def self.error(message) Fontist.ui.error("❌ #{message}") end
Display error message
@param message [String] Error message
Source
# File lib/fontist/import/import_display.rb, line 166 def self.following_link(text) debug_info("Following #{text}...") end
Display “Following link…” message
@param text [String] Link description
Source
# File lib/fontist/import/import_display.rb, line 182 def self.format_duration(seconds) return "#{seconds.round(2)}s" if seconds < 60 minutes = (seconds / 60).floor remaining = (seconds % 60).round(2) if minutes < 60 "#{minutes}m #{remaining}s" else hours = (minutes / 60).floor remaining_minutes = minutes % 60 "#{hours}h #{remaining_minutes}m #{remaining.round}s" end end
Format duration in human-readable format
@param seconds [Float] Duration in seconds @return [String] Formatted duration
Source
# File lib/fontist/import/import_display.rb, line 174 def self.found_elements(count, selector) debug_info("Found #{count} '#{selector}' elements") if count.positive? end
Display “Found N elements” message
@param count [Integer] Number of elements @param selector [String] CSS selector name
Source
# File lib/fontist/import/import_display.rb, line 15 def self.header(source, details = {}, import_cache: nil) Fontist.ui.say("") Fontist.ui.say(Paint["═" * 80, :cyan]) Fontist.ui.say(Paint[" 📦 #{source} Import", :cyan, :bright]) Fontist.ui.say(Paint["═" * 80, :cyan]) Fontist.ui.say("") # Show import cache if provided if import_cache cache_path = import_cache.is_a?(Pathname) ? import_cache.to_s : import_cache.to_s Fontist.ui.say("📦 Import cache: #{Paint[cache_path, :white]}") end # Show other details details.each do |key, value| next unless value label = key.to_s.split("_").map(&:capitalize).join(" ") Fontist.ui.say("📁 #{label}: #{Paint[value.to_s, :white]}") end Fontist.ui.say("") end
Source
# File lib/fontist/import/import_display.rb, line 123 def self.info(message) Fontist.ui.say(" ℹ️ #{message}") end
Display info message
@param message [String] Info message
Source
# File lib/fontist/import/import_display.rb, line 151 def self.page_url(url) Fontist.ui.say(" #{Paint['🔗', :blue]} Page URL: #{Paint[url, :white]}") end
Display page URL being visited
@param url [String] Page URL
Source
# File lib/fontist/import/import_display.rb, line 45 def self.progress(current, total, item, details: nil) progress_text = "(#{current}/#{total})" percentage = ((current.to_f / total) * 100).round(1) line = "#{Paint[progress_text, :white]} " \ "#{Paint["#{percentage}%", :yellow]} | " \ "#{Paint[item, :cyan, :bright]}" line += " #{Paint[details, :black, :bright]}" if details Fontist.ui.say(line) end
Display progress update with Paint styling
@param current [Integer] Current count @param total [Integer] Total count @param item [String] Item being processed @param details [String] Optional details (e.g., “(3 fonts)”)
Source
# File lib/fontist/import/import_display.rb, line 114 def self.section(title) Fontist.ui.say("") Fontist.ui.say("── #{title} " + "─" * (76 - title.length)) Fontist.ui.say("") end
Display section header
@param title [String] Section title (deprecated - use header instead)
Source
# File lib/fontist/import/import_display.rb, line 86 def self.status_failed(message) error_display = message.length > 60 ? "#{message[0..60]}..." : message Fontist.ui.say(" #{Paint['✗', :red]} Failed: #{Paint[error_display, :red]}") end
Display failure status
@param message [String] Error message
Source
# File lib/fontist/import/import_display.rb, line 95 def self.status_overwrite(message) Fontist.ui.say(" #{Paint['⚠', :yellow]} #{message}") end
Display overwrite warning
@param message [String] Warning message
Source
# File lib/fontist/import/import_display.rb, line 78 def self.status_skipped(message, tip: nil) Fontist.ui.say(" #{Paint['⊝', :yellow]} #{message}") Fontist.ui.say(" #{Paint['ℹ', :blue]} #{tip}") if tip end
Display skip status
@param message [String] Skip message @param tip [String] Optional tip for user
Source
# File lib/fontist/import/import_display.rb, line 62 def self.status_success(message, details = "") detail_text = if details.empty? "" else " #{Paint[details, :black, :bright]}" end Fontist.ui.say(" #{Paint['✓', :green]} #{Paint[message, :white]}#{detail_text}") end
Display success status
@param message [String] Success message @param details [String] Optional details (e.g., formula name, timing)
Source
# File lib/fontist/import/import_display.rb, line 103 def self.summary(results, options = {}) print_summary_header print_summary_stats(results) print_summary_errors(results) if results[:errors]&.any? print_summary_tips(results, options) print_summary_footer(results) end
Display summary with Paint styling
@param results [Hash] Results hash with :successful, :failed, :duration keys @param options [Hash] Display options (:force, :show_tips, etc.)
Source
# File lib/fontist/import/import_display.rb, line 137 def self.warn(message) Fontist.ui.say(" ⚠️ #{message}") end
Display warning message
@param message [String] Warning message