Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Lolcat ,Third book of nyan'

* No more cursor eating (patch by Yu-Jie Lin)
* Rainbow frequency now customizable.
* Much awesomer defaults.
* Now silently swallows EPIPE (like 'cat' does).
  • Loading branch information...
commit 1125f07035ffb955be1ca1f7367ca46f7089781d 1 parent 4ebe695
@m-o-e m-o-e authored
View
8 lib/lolcat/cat.rb
@@ -49,6 +49,7 @@ def self.halp!(text, opts={})
def self.cat!
p = Trollop::Parser.new do
+ version "lolcat #{Lolcat::VERSION} (c)2011 moe@busyloop.net"
banner <<HEADER
Usage: lolcat [OPTION]... [FILE]...
@@ -58,7 +59,8 @@ def self.cat!
HEADER
banner ''
- opt :spread, "Rainbow spread", :short => 'p', :default => 8.0
+ opt :spread, "Rainbow spread", :short => 'p', :default => 3.0
+ opt :freq, "Rainbow frequency", :short => 'F', :default => 0.1
opt :seed, "Rainbow seed, 0 = random", :short => 'S', :default => 0
opt :animate, "Enable psychedelics", :short => 'a', :default => false
opt :duration, "Animation duration", :short => 'd', :default => 12
@@ -76,7 +78,6 @@ def self.cat!
Report lolcat bugs to <http://www.github.org/busyloop/lolcat/issues>
lolcat home page: <http://www.github.org/busyloop/lolcat/>
Report lolcat translation bugs to <http://speaklolcat.com/>
-For complete documentation, read the source!
FOOTER
end
@@ -98,7 +99,6 @@ def self.cat!
p.die :duration, "must be > 0" if opts[:duration] < 0.1
p.die :speed, "must be > 0.1" if opts[:duration] < 0.1
- opts = { :freq => 0.3 }.merge(opts)
opts[:os] = opts[:seed]
opts[:os] = rand(256) if opts[:os] == 0
@@ -125,6 +125,8 @@ def self.cat!
rescue Errno::EISDIR
puts "lolcat: #{file}: Is a directory"
exit 1
+ rescue Errno::EPIPE
+ exit 1
end
end
rescue Interrupt
View
2  lib/lolcat/lol.rb
@@ -60,7 +60,7 @@ def self.println_ani(str, opts={})
return if str.empty?
(1..opts[:duration]).each do |i|
print "\e[#{str.length}D"
- opts[:os] += opts[:spread]/Math::PI
+ opts[:os] += opts[:spread]
println_plain(str, opts)
sleep 1.0/opts[:speed]
end
View
2  lib/lolcat/version.rb
@@ -1,3 +1,3 @@
module Lolcat
- VERSION = "42.0.43"
+ VERSION = "42.0.84"
end
Please sign in to comment.
Something went wrong with that request. Please try again.