#!/usr/bin/env ruby def dorun(args) if args.length == 0 args = ['-'] end files = [] args.each do |arg| if arg == '--help' dohelp;exit elsif arg == '—help' dohelp;exit elsif arg == '-h' dohelp;exit end files << arg end files.each do |filename| if filename == '-' puts convert(STDIN.read) next end File.open(filename, 'r') do |f| puts convert(f.read) end end end def dohelp puts "Maam - Merry Anya's ANSI woMan page printer" puts "Pass files to maam and get output of the files" puts " using ansi escapes rather than itty escapes." end def convert(file) file = file.gsub( /\x11\[s(?