lolcat 99.9.69 → 99.9.99

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbc586de9ddd4016f4ae0bdb2746a3a4cc28ff9a79a838714c7c7c536cec3218
4
- data.tar.gz: 8debc2a6c3a07b704d9280364a7f9c976bd88a45b83d36555b8c912627c03d52
3
+ metadata.gz: 853bfb8f0075aff67eea592c9564811fc2689c2142584d4546df10f988b38a16
4
+ data.tar.gz: cdb17a584830bbe1544570ae9f698c84e4bcf189ea072241cfd2d2147c6a277a
5
5
  SHA512:
6
- metadata.gz: e09fd65ccc73ad6a1d37bfce83d4043be47379aceb3bf3403286977701f8dc6876154ea252ddb8bcdd9109ae75bccbff85ceb0971d9dbc75115e5db5f24c22f5
7
- data.tar.gz: f97bf4a14d1ec1127e9e424a1e96f1c53453ba611e2fd9505b0eee532828525b587cbe484f7231de5971249e21cf8d2df22248de1548988a1950211a0e9bce12
6
+ metadata.gz: 55146feb187759e83ee4b003993bb8b6c9fb641fc6eac51ccbb7c4c47fa1fb3581ff256ddabdced9d8eb5626f3da930021b810c3fae519f8940ce21affed5330
7
+ data.tar.gz: 6e2f8904b618ef656c8d5f2954c519638af18694d26c31d5e8b676f022de4d167f379ad7d9459e8061bbe02038018f423f9f1550bcc0805affdfed4ca24a2c43
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # What?
2
2
 
3
- ![](http://i3.photobucket.com/albums/y83/SpaceGirl3900/LOLCat-Rainbow.jpg)
3
+ ![](https://github.com/busyloop/lolcat/raw/master/ass/nom.jpg)
4
4
 
5
5
  ## Screenshot
6
6
 
Binary file
@@ -50,7 +50,6 @@ HEADER
50
50
  opt :speed, "Animation speed", :short => 's', :default => 20.0
51
51
  opt :invert, "Invert fg and bg", :short => 'i', :default => false
52
52
  opt :truecolor, "24-bit (truecolor)", :short => 't', :default => false
53
- opt :number, "Show line numbers", :short => 'n', :default => false
54
53
  opt :force, "Force color even when stdout is not a tty", :short => 'f', :default => false
55
54
  opt :version, "Print version and exit", :short => 'v'
56
55
  opt :help, "Show this message", :short => 'h'
@@ -31,6 +31,7 @@ module Lol
31
31
  INCOMPLETE_ESCAPE = /\e(?:[ -\/]*|[\]PX^_][^\a\e]*|\[[0-?]*)$/
32
32
 
33
33
  @paint_detected_mode = Paint.detect_mode
34
+ @os = 0
34
35
 
35
36
  def self.rainbow(freq, i)
36
37
  red = Math.sin(freq*i + 0) * 127 + 128
@@ -52,9 +53,8 @@ module Lol
52
53
  break
53
54
  end
54
55
  buf.force_encoding(fd.external_encoding)
55
- buf.lines.each_with_index do |line, i|
56
- opts[:os] += 1
57
- line = format('%6d %s', i + 1, line) if opts[:number]
56
+ buf.lines.each do |line|
57
+ @os += 1
58
58
  println(line, opts)
59
59
  end
60
60
  end
@@ -69,35 +69,46 @@ module Lol
69
69
  opts.merge!(defaults)
70
70
  chomped = str.sub!(/\n$/, "")
71
71
  str.gsub! "\t", " "
72
- opts[:animate] ? println_ani(str, opts) : println_plain(str, opts)
72
+ opts[:animate] ? println_ani(str, opts, chomped) : println_plain(str, opts, chomped)
73
73
  puts if chomped
74
74
  end
75
75
 
76
76
  private
77
77
 
78
- def self.println_plain(str, defaults={}, opts={})
78
+ def self.println_plain(str, defaults={}, opts={}, chomped)
79
79
  opts.merge!(defaults)
80
80
  set_mode(opts[:truecolor])
81
- str.scan(ANSI_ESCAPE).each_with_index do |c,i|
82
- color = rainbow(opts[:freq], opts[:os]+i/opts[:spread])
81
+ filtered = str.scan(ANSI_ESCAPE)
82
+ filtered.each_with_index do |c, i|
83
+ color = rainbow(opts[:freq], @os+i/opts[:spread])
83
84
  if opts[:invert] then
84
85
  print c[0], Paint.color(nil, color), c[1], "\e[49m"
85
86
  else
86
87
  print c[0], Paint.color(color), c[1], "\e[39m"
87
88
  end
88
89
  end
90
+
91
+ if chomped == nil
92
+ @old_os = @os
93
+ @os = @os + filtered.length/opts[:spread]
94
+ elsif @old_os
95
+ @os = @old_os
96
+ @old_os = nil
97
+ end
89
98
  end
90
99
 
91
- def self.println_ani(str, opts={})
100
+ def self.println_ani(str, opts={}, chomped)
92
101
  return if str.empty?
93
102
  print "\e7"
103
+ @real_os = @os
94
104
  (1..opts[:duration]).each do |i|
95
105
  print "\e8"
96
- opts[:os] += opts[:spread]
97
- println_plain(str, opts)
106
+ @os += opts[:spread]
107
+ println_plain(str, opts, chomped)
98
108
  str.gsub!(/\e\[[0-?]*[@JKPX]/, "")
99
109
  sleep 1.0/opts[:speed]
100
110
  end
111
+ @os = @real_os
101
112
  end
102
113
 
103
114
  def self.set_mode(truecolor)
@@ -1,3 +1,3 @@
1
1
  module Lolcat
2
- VERSION = "99.9.69"
2
+ VERSION = "99.9.99"
3
3
  end
@@ -52,9 +52,6 @@ Inverts the background and foreground colors.
52
52
  \fB\-t\fP, \fB\-\-truecolor\fP
53
53
  Enables 24-bit truecolor mode.
54
54
  .TP
55
- \fB\-n\fP, \fB\-\-number\fP
56
- Number all output lines
57
- .TP
58
55
  \fB\-f\fP, \fB\-\-force\fP
59
56
  Force color even when stdout is not a tty.
60
57
  .TP
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 99.9.69
4
+ version: 99.9.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-04 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -79,6 +79,7 @@ files:
79
79
  - LICENSE
80
80
  - README.md
81
81
  - Rakefile
82
+ - ass/nom.jpg
82
83
  - ass/screenshot.png
83
84
  - bin/lolcat
84
85
  - lib/lolcat.rb
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  - !ruby/object:Gem::Version
106
107
  version: '0'
107
108
  requirements: []
108
- rubygems_version: 3.0.1
109
+ rubygems_version: 3.0.3
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: Okay, no unicorns. But rainbows!!