Sha256: 5358ac536b171121a8f69bf3a425ba460460f2e0e7739d9781c691de1803ebf5

Contents?: true

Size: 320 Bytes

Versions: 1

Compression:

Stored size: 320 Bytes

Contents

#!/usr/bin/env ruby
STDOUT.sync = true
trap("SIGINT") { exit! }

say = if ARGV.any?
  ARGV.join " "
elsif !(stdin = STDIN.read).empty?
  stdin.chomp
end

if say
  loop do
    STDOUT.print "\r\x1b[#{31+($.+=1)%7}m#{say}"
    STDOUT.print "\e[0m"
    sleep 0.3
  end
else
  puts "Usage: rainbow_say <something witty>"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rainbow_say-0.0.3 bin/rainbow_say