lolcat 90.8.8 → 99.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4cb8847b38684f396a400f4d01f3595555a0f33c
4
- data.tar.gz: 23dbcbfedba01cae193f3cc4342092c11d1700ce
2
+ SHA256:
3
+ metadata.gz: 5b2f2da553496da9167b641f9490b602b7c7ab20939855328e5b11ba576981ac
4
+ data.tar.gz: fb4269af6402efb41734d960e7dc5645d3407e2140a1adcaf9d2346a853d3064
5
5
  SHA512:
6
- metadata.gz: ba16f88e2a4406866bec512f053e6d0cf15ac1e656e12a5fd85fbd51519c7c067ccf7330b932ac3bb69c6232f4d5212838a12ebe6258ef39e6f3df491e22708a
7
- data.tar.gz: 35fd7b9b9a9b4ae7490cbb5701a9a197380e33ab37eff963545a43be94c9d02666074c02e3743f274e048eebad421643502a669060b810ef263b81cb0db0ed2f
6
+ metadata.gz: 836bb75c723ea7c49f4ea1201ab2a301bedc9c61db9a4995d8e7191f15ae4792dc856144bb592dab0dcc167234a968afb997f6b1b3323384eb07f679f5c7189b
7
+ data.tar.gz: 5678cebdb25b01d6115d20fbf8cfdb67a4904d1dc715671d40359ddce1ad080d9cd99f45ca062fe92eab3ed6913621ed6c67506eb625ecff31787ade038c9d74
@@ -82,7 +82,7 @@ FOOTER
82
82
  :spread => 8.0,
83
83
  :freq => 0.3
84
84
  }
85
- Lol.cat buf.read.split(/(?<=\n)/), opts
85
+ Lol.cat buf, opts
86
86
  puts
87
87
  buf.close
88
88
  exit 1
@@ -112,9 +112,7 @@ FOOTER
112
112
  $stdout.write(line)
113
113
  end
114
114
  else
115
- until fd.eof? do
116
- $stdout.write(fd.read(8192))
117
- end
115
+ IO.copy_stream(fd, $stdout)
118
116
  end
119
117
  end
120
118
  rescue Errno::ENOENT
@@ -27,7 +27,6 @@ require "lolcat/version"
27
27
  require 'paint'
28
28
 
29
29
  module Lol
30
- STRIP_ANSI = Regexp.compile '\e\[[\d;]*[m|K]', nil
31
30
  @paint_detected_mode = Paint.detect_mode
32
31
 
33
32
  def self.rainbow(freq, i)
@@ -39,18 +38,28 @@ module Lol
39
38
 
40
39
  def self.cat(fd, opts={})
41
40
  print "\e[?25l" if opts[:animate]
42
- fd.each do |line|
43
- opts[:os] += 1
44
- println(line, opts)
41
+ while true do
42
+ begin
43
+ buf = fd.sysread(65536)
44
+ rescue EOFError
45
+ break
46
+ end
47
+ buf.force_encoding(fd.external_encoding)
48
+ buf.lines.each do |line|
49
+ opts[:os] += 1
50
+ println(line, opts)
51
+ end
45
52
  end
46
53
  ensure
47
- print "\e[?25h" if opts[:animate]
54
+ if STDOUT.tty? then
55
+ print "\e[m\e[?25h\e[?1;5;47;2004l"
56
+ system("stty cooked -nl <&1");
57
+ end
48
58
  end
49
59
 
50
60
  def self.println(str, defaults={}, opts={})
51
61
  opts.merge!(defaults)
52
- chomped = str.chomp!
53
- str.gsub! STRIP_ANSI, '' if !str.nil? and ($stdout.tty? or opts[:force])
62
+ chomped = str.sub!(/\n$/, "")
54
63
  str.gsub! "\t", " "
55
64
  opts[:animate] ? println_ani(str, opts) : println_plain(str, opts)
56
65
  puts if chomped
@@ -61,18 +70,20 @@ module Lol
61
70
  def self.println_plain(str, defaults={}, opts={})
62
71
  opts.merge!(defaults)
63
72
  set_mode(opts[:truecolor])
64
- str.chomp.chars.each_with_index do |c,i|
73
+ str.scan(/((?:\e(?:[ -\/]+.|[\]PX^_][^\a\e]*|\[[0-?]*.|.))*)(.?)/m).each_with_index do |c,i|
65
74
  code = rainbow(opts[:freq], opts[:os]+i/opts[:spread])
66
- print Paint[c, *[ (:black if opts[:invert]), code ].compact ]
75
+ print c[0], Paint[c[1], *[ (:black if opts[:invert]), code ].compact ]
67
76
  end
68
77
  end
69
78
 
70
79
  def self.println_ani(str, opts={})
71
80
  return if str.empty?
81
+ print "\e7"
72
82
  (1..opts[:duration]).each do |i|
73
- print "\e[#{str.length}D"
83
+ print "\e8"
74
84
  opts[:os] += opts[:spread]
75
85
  println_plain(str, opts)
86
+ str.gsub!(/\e\[[0-?]*[@JKPX]/, "")
76
87
  sleep 1.0/opts[:speed]
77
88
  end
78
89
  end
@@ -1,3 +1,3 @@
1
1
  module Lolcat
2
- VERSION = "90.8.8"
2
+ VERSION = "99.9.9"
3
3
  end
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_development_dependency "rake"
15
15
  s.add_dependency "paint", "~> 2.0.0"
16
16
  s.add_dependency "trollop", "~> 2.1.2"
17
+ s.add_dependency "manpages", "~> 0.6.1"
17
18
 
18
19
  s.files = `git ls-files`.split("\n")
19
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -0,0 +1,100 @@
1
+ .TH LOLCAT 6 "June 11, 2017"
2
+ .\" Please adjust this date whenever revising the manpage.
3
+ .SH NAME
4
+ lolcat \- rainbow coloring effect for text console display
5
+
6
+ .SH SYNOPSIS
7
+ .B lolcat
8
+ .RI [ options ] " " [ files ] " " ...
9
+
10
+ .SH DESCRIPTION
11
+ This manual page documents briefly the
12
+ .B lolcat
13
+ command.
14
+ .PP
15
+ \fBlolcat\fP is a program that concatenates files, or standard input, to
16
+ standard output (like the generic \fBcat\fP), and adds rainbow coloring to it.
17
+
18
+ .SH OPTIONS
19
+
20
+ .TP
21
+ \fB\-p\fP \fIX\fP, \fB\-\-spread=\fIX\fP
22
+ Inclination of the rainbow stripes
23
+ .br
24
+ (character widths per line hight; high values (>1000) give almost horizonal stripes, low values (0.1) almost vertical ones; default: 3.0).
25
+ .TP
26
+ \fB\-F\fP \fIX\fP, \fB\-\-freq=\fIX\fP
27
+ Frequency of the rainbow effect.
28
+ .br
29
+ (low values around 0.0001 give almost monochromous screens; default: 0.1).
30
+ .TP
31
+ \fB\-S\fP \fIX\fP, \fB\-\-seed=\fIX\fP
32
+ Initial value for the random number generator; 0 means automatic.
33
+ .br
34
+ (default: 0).
35
+ .TP
36
+ \fB\-a\fP, \fB\-\-animate\fP
37
+ Fade every line through an animation before printing the next one.
38
+ .TP
39
+ \fB\-d\fP \fIX\fP, \fB\-\-duration=\fIX\fP
40
+ Duration of the animation.
41
+ .br
42
+ (number of steps before showing next line; default: 12)
43
+ .TP
44
+ \fB\-s\fP \fIX\fP, \fB\-\-speed=\fIX\fP
45
+ Speed of the animation.
46
+ .br
47
+ (frame rate, ie. number of steps per second; default: 20)
48
+ .TP
49
+ \fB\-i\fP, \fB\-\-invert\fP
50
+ Inverts the background and foreground colors.
51
+ .TP
52
+ \fB\-t\fP, \fB\-\-truecolor\fP
53
+ Enables 24-bit truecolor mode.
54
+ .TP
55
+ \fB\-f\fP, \fB\-\-force\fP
56
+ Force color even when stdout is not a tty.
57
+ .TP
58
+ .B \-v, \-\-version
59
+ Shows lolcat version.
60
+ .TP
61
+ .B \-h, \-\-help
62
+ Shows options summary.
63
+
64
+ .SH EXAMPLES
65
+
66
+ Typical combinations of \fBlolcat\fP include other programs that generate text:
67
+ .br
68
+ .br
69
+ Large colorful words can be written like this:
70
+
71
+ .IP
72
+ .EX
73
+ echo "KTHXBAI" | toilet | lolcat
74
+ .EE
75
+ .
76
+ .P
77
+
78
+ Cows are popular, come in all colors, and tell random epigrams:
79
+
80
+ .IP
81
+ .EX
82
+ fortune | cowsay | lolcat \-a
83
+ .EE
84
+ .
85
+ .P
86
+
87
+ .SH SEE ALSO
88
+ .BR cat (1),
89
+ .BR toilet (1),
90
+ .BR fortune (6),
91
+ .BR cowsay (6)
92
+ .br
93
+ .SH AUTHOR
94
+ lolcat was written by Moe <moe@busyloop.net>.
95
+ .PP
96
+ This manual page was originally written by chrysn <chrysn@fsfe.org>,
97
+ for the Debian project.
98
+ .br
99
+ Very quickly revamped by Mathieu Aubin <mathieu@zeroserieux.com> to
100
+ include as part of official code repository.
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: 90.8.8
4
+ version: 99.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-14 00:00:00.000000000 Z
11
+ date: 2018-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.1.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: manpages
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.1
55
69
  description: Rainbows and unicorns!
56
70
  email:
57
71
  - moe@busyloop.net
@@ -72,6 +86,7 @@ files:
72
86
  - lib/lolcat/lol.rb
73
87
  - lib/lolcat/version.rb
74
88
  - lolcat.gemspec
89
+ - man/lolcat.6
75
90
  homepage: https://github.com/busyloop/lolcat
76
91
  licenses: []
77
92
  metadata: {}
@@ -91,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
106
  version: '0'
92
107
  requirements: []
93
108
  rubyforge_project:
94
- rubygems_version: 2.5.2
109
+ rubygems_version: 2.7.3
95
110
  signing_key:
96
111
  specification_version: 4
97
112
  summary: Okay, no unicorns. But rainbows!!