lolcat 42.24.1 → 99.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/lolcat/cat.rb +2 -4
- data/lib/lolcat/lol.rb +34 -12
- data/lib/lolcat/version.rb +1 -1
- data/lolcat.gemspec +1 -0
- data/man/lolcat.6 +100 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a313766343e4d204f03d600659987b0c910dc8afd3fbc420987a01ed3f829fc6
|
4
|
+
data.tar.gz: b01cf6ef9c92806257e88ee14416e428330531a128cd7c7ec8c6e47970c5e5b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c84d710091c29b29611c089090515cc5c26c69e33517ca894eb9f28363f794edeb324a5aa5687addca1ea9d1f94dd553b08b55cef9d9270cf269cd46abf041
|
7
|
+
data.tar.gz: 383ba55cf86ab59a187a2085df85e29d7b70cbb4c6e302680bb4e9fb17b975f214c5de6bc78882871fabc4f7df4047f5965e112539d6f7833b49055ebee656e2
|
data/lib/lolcat/cat.rb
CHANGED
@@ -82,7 +82,7 @@ FOOTER
|
|
82
82
|
:spread => 8.0,
|
83
83
|
:freq => 0.3
|
84
84
|
}
|
85
|
-
Lol.cat buf
|
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
|
-
|
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
|
data/lib/lolcat/lol.rb
CHANGED
@@ -27,7 +27,10 @@ require "lolcat/version"
|
|
27
27
|
require 'paint'
|
28
28
|
|
29
29
|
module Lol
|
30
|
-
|
30
|
+
ANSI_ESCAPE = /((?:\e(?:[ -\/]+.|[\]PX^_][^\a\e]*|\[[0-?]*.|.))*)(.?)/m
|
31
|
+
INCOMPLETE_ESCAPE = /\e(?:[ -\/]*|[\]PX^_][^\a\e]*|\[[0-?]*)$/
|
32
|
+
INCOMPLETE_UTF8 = /[\xc0-\xdf]$|[\xe0-\xef].?$|[\xf0-\xf7].?.?$/n
|
33
|
+
|
31
34
|
@paint_detected_mode = Paint.detect_mode
|
32
35
|
|
33
36
|
def self.rainbow(freq, i)
|
@@ -39,21 +42,34 @@ module Lol
|
|
39
42
|
|
40
43
|
def self.cat(fd, opts={})
|
41
44
|
print "\e[?25l" if opts[:animate]
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
+
while true do
|
46
|
+
buf = ''
|
47
|
+
begin
|
48
|
+
begin
|
49
|
+
buf += fd.sysread(4096)
|
50
|
+
end while buf.match(INCOMPLETE_ESCAPE) or (fd.external_encoding == 'UTF-8' and buf.match(INCOMPLETE_UTF8))
|
51
|
+
rescue EOFError
|
52
|
+
break
|
53
|
+
end
|
54
|
+
buf.force_encoding(fd.external_encoding)
|
55
|
+
buf.lines.each do |line|
|
56
|
+
opts[:os] += 1
|
57
|
+
println(line, opts)
|
58
|
+
end
|
45
59
|
end
|
46
60
|
ensure
|
47
|
-
|
61
|
+
if STDOUT.tty? then
|
62
|
+
print "\e[m\e[?25h\e[?1;5;2004l"
|
63
|
+
system("stty sane -istrip <&1");
|
64
|
+
end
|
48
65
|
end
|
49
66
|
|
50
67
|
def self.println(str, defaults={}, opts={})
|
51
68
|
opts.merge!(defaults)
|
52
|
-
str.
|
53
|
-
str.gsub! STRIP_ANSI, '' if !str.nil? and ($stdout.tty? or opts[:force])
|
69
|
+
chomped = str.sub!(/\n$/, "")
|
54
70
|
str.gsub! "\t", " "
|
55
71
|
opts[:animate] ? println_ani(str, opts) : println_plain(str, opts)
|
56
|
-
puts
|
72
|
+
puts if chomped
|
57
73
|
end
|
58
74
|
|
59
75
|
private
|
@@ -61,18 +77,24 @@ module Lol
|
|
61
77
|
def self.println_plain(str, defaults={}, opts={})
|
62
78
|
opts.merge!(defaults)
|
63
79
|
set_mode(opts[:truecolor])
|
64
|
-
str.
|
65
|
-
|
66
|
-
|
80
|
+
str.scan(ANSI_ESCAPE).each_with_index do |c,i|
|
81
|
+
color = rainbow(opts[:freq], opts[:os]+i/opts[:spread])
|
82
|
+
if opts[:invert] then
|
83
|
+
print c[0], Paint.color(nil, color), c[1], "\e[49m"
|
84
|
+
else
|
85
|
+
print c[0], Paint.color(color), c[1], "\e[39m"
|
86
|
+
end
|
67
87
|
end
|
68
88
|
end
|
69
89
|
|
70
90
|
def self.println_ani(str, opts={})
|
71
91
|
return if str.empty?
|
92
|
+
print "\e7"
|
72
93
|
(1..opts[:duration]).each do |i|
|
73
|
-
print "\
|
94
|
+
print "\e8"
|
74
95
|
opts[:os] += opts[:spread]
|
75
96
|
println_plain(str, opts)
|
97
|
+
str.gsub!(/\e\[[0-?]*[@JKPX]/, "")
|
76
98
|
sleep 1.0/opts[:speed]
|
77
99
|
end
|
78
100
|
end
|
data/lib/lolcat/version.rb
CHANGED
data/lolcat.gemspec
CHANGED
@@ -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")
|
data/man/lolcat.6
ADDED
@@ -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:
|
4
|
+
version: 99.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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.
|
109
|
+
rubygems_version: 2.7.3
|
95
110
|
signing_key:
|
96
111
|
specification_version: 4
|
97
112
|
summary: Okay, no unicorns. But rainbows!!
|