module BannerEngines
BannerEngines β catalog of text banner CLIs plus internal block glyphs. chafa/jp2a are image-only and excluded from the random pool for text headings.
Engine flag audit (from installed βhelp): | Engine | IRC colour | argv notes | |βββ|ββββββββ-|ββββββββββββ-| | blocks | via IrcFormat.decorate | internal opencode glyphs | | figlet | none | -w 80 (matches MAX_LINE_WIDTH) | | toilet | βirc (mIRC \x03 codes) | -W full width + βirc | | cowsay | none | -W 78 wrap within IRC width | | boxes | none (ANSI via βcolor) | -d cat + stdin | | artii | none | plain artii text | | lolcat | none (ANSI rainbow) | figlet pipeline; strip ANSI | | cfonts | none | plain cfonts text |
Public: ENGINES, available, pick, fetch, argv_for, resolve_id Depends: (none) Tests: test/lib/banner_engines_test.rb
Constants
- ENGINES
Public Instance Methods
Source
# File lib/banner_engines.rb, line 40 def argv_for(id, text, extras: []) entry = fetch(id) return nil unless entry&.dig(:argv) entry[:argv].call(text, extras: extras) end
Source
# File lib/banner_engines.rb, line 52 def available(executable: default_executable) ENGINES.keys.select do |id| entry = ENGINES[id] next true if entry[:type] == :internal if entry[:pipeline] entry[:pipeline].all? { |stage_id| executable.call(ENGINES.fetch(stage_id)[:bin]) } else executable.call(entry[:bin]) end end end
Source
# File lib/banner_engines.rb, line 70 def default_executable lambda do |bin| ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).any? do |dir| path = File.join(dir, bin) File.file?(path) && File.executable?(path) end end end
Source
# File lib/banner_engines.rb, line 64 def pick(rng: Random, pool: nil, executable: default_executable) candidates = pool || available(executable: executable) candidates = [:blocks] if candidates.empty? candidates[rng.rand(candidates.length)] end
Source
# File lib/banner_engines.rb, line 47 def resolve_id(token) id = token.to_s.strip.downcase.to_sym ENGINES.key?(id) ? id : nil end