tty icon indicating copy to clipboard operation
tty copied to clipboard

suggestion: banner

Open gurgeous opened this issue 9 years ago • 2 comments

It would be great to support banners. We use this a lot in our scripts.

image

gurgeous avatar Feb 18 '16 17:02 gurgeous

That sounds useful, I would be interested in the api, do you have any code examples to show?

piotrmurach avatar Feb 27 '16 17:02 piotrmurach

Sure - note that the ANSI colors are defined as constants. I'd be happy to wrap this up as a PR that uses pastel if you give me a bit of direction. :)

def banner(str, color: GREEN)
  now = Time.new.strftime("%H:%M:%S")
  s = "#{str} ".ljust(72, " ")
  puts "#{color}[#{now}] #{s}#{RESET}"
end

and usage:

banner("Factoring primes...")

gurgeous avatar Feb 27 '16 18:02 gurgeous