lolcat 42.0.43 → 42.0.84

Sign up to get free protection for your applications and to get access to all the features.
data/lib/lolcat/cat.rb CHANGED
@@ -49,6 +49,7 @@ module Lol
49
49
 
50
50
  def self.cat!
51
51
  p = Trollop::Parser.new do
52
+ version "lolcat #{Lolcat::VERSION} (c)2011 moe@busyloop.net"
52
53
  banner <<HEADER
53
54
 
54
55
  Usage: lolcat [OPTION]... [FILE]...
@@ -58,7 +59,8 @@ With no FILE, or when FILE is -, read standard input.
58
59
 
59
60
  HEADER
60
61
  banner ''
61
- opt :spread, "Rainbow spread", :short => 'p', :default => 8.0
62
+ opt :spread, "Rainbow spread", :short => 'p', :default => 3.0
63
+ opt :freq, "Rainbow frequency", :short => 'F', :default => 0.1
62
64
  opt :seed, "Rainbow seed, 0 = random", :short => 'S', :default => 0
63
65
  opt :animate, "Enable psychedelics", :short => 'a', :default => false
64
66
  opt :duration, "Animation duration", :short => 'd', :default => 12
@@ -76,7 +78,6 @@ Examples:
76
78
  Report lolcat bugs to <http://www.github.org/busyloop/lolcat/issues>
77
79
  lolcat home page: <http://www.github.org/busyloop/lolcat/>
78
80
  Report lolcat translation bugs to <http://speaklolcat.com/>
79
- For complete documentation, read the source!
80
81
 
81
82
  FOOTER
82
83
  end
@@ -98,7 +99,6 @@ FOOTER
98
99
  p.die :duration, "must be > 0" if opts[:duration] < 0.1
99
100
  p.die :speed, "must be > 0.1" if opts[:duration] < 0.1
100
101
 
101
- opts = { :freq => 0.3 }.merge(opts)
102
102
  opts[:os] = opts[:seed]
103
103
  opts[:os] = rand(256) if opts[:os] == 0
104
104
 
@@ -125,6 +125,8 @@ FOOTER
125
125
  rescue Errno::EISDIR
126
126
  puts "lolcat: #{file}: Is a directory"
127
127
  exit 1
128
+ rescue Errno::EPIPE
129
+ exit 1
128
130
  end
129
131
  end
130
132
  rescue Interrupt
data/lib/lolcat/lol.rb CHANGED
@@ -30,10 +30,13 @@ module Lol
30
30
  end
31
31
 
32
32
  def self.cat(fd, opts={})
33
+ print "\e[?25l" if opts[:animate]
33
34
  fd.each do |line|
34
35
  opts[:os] += 1
35
36
  println(line, opts)
36
37
  end
38
+ ensure
39
+ print "\e[?25h" if opts[:animate]
37
40
  end
38
41
 
39
42
  def self.println(str, defaults={}, opts={})
@@ -57,7 +60,7 @@ module Lol
57
60
  return if str.empty?
58
61
  (1..opts[:duration]).each do |i|
59
62
  print "\e[#{str.length}D"
60
- opts[:os] += opts[:spread]/Math::PI
63
+ opts[:os] += opts[:spread]
61
64
  println_plain(str, opts)
62
65
  sleep 1.0/opts[:speed]
63
66
  end
@@ -1,3 +1,3 @@
1
1
  module Lolcat
2
- VERSION = "42.0.43"
2
+ VERSION = "42.0.84"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 42
7
7
  - 0
8
- - 43
9
- version: 42.0.43
8
+ - 84
9
+ version: 42.0.84
10
10
  platform: ruby
11
11
  authors:
12
12
  - Moe