color_echo 0.5.0 → 0.6.0
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 +4 -4
- data/README.md +26 -5
- data/bin/color_echo +147 -0
- data/lib/color_echo.rb +6 -6
- data/lib/color_echo/const.rb +11 -0
- data/lib/color_echo/{background.module.rb → module/background.rb} +0 -0
- data/lib/color_echo/{foreground.module.rb → module/foreground.rb} +0 -0
- data/lib/color_echo/{off.module.rb → module/off.rb} +0 -0
- data/lib/color_echo/{textattr.module.rb → module/textattr.rb} +0 -0
- metadata +15 -14
- data/lib/color_echo/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 120d4b59dd2fd42500f5936e8d0a48ecaa022640
|
4
|
+
data.tar.gz: 121a6a958155b520f09fb50ed975e77776f3c3dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5382227d1dbdc744c494ec55d4d20b760e44dfac856e68878f5a780b7bc86bb39aa14a120ae8a2e0cb35ffcb6841ce9fe16d56106278d956993e575a38e6ed56
|
7
|
+
data.tar.gz: 5679f4b1a3e012ed0860509e959bbe8c72a160e9b139d33b60888039e1de4c88b9cd423e985ffe448478a03d3f0aaf767ec1971e6690ec3f9cfa61cd1d806afc
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# color_echo
|
2
|
-
|
2
|
+
Decorate the command line output with ANSI escape sequence.
|
3
3
|
This Library will extend the Kernel module's functions(#print, #puts, #p).
|
4
4
|
Required StringIO.
|
5
5
|
|
6
|
-
Version: 0.
|
6
|
+
Version: 0.6.0
|
7
7
|
Compliant Rubys Version: 1.9.3, 2.0.0, 2.1.0 (for Linux)
|
8
8
|
License: MIT
|
9
9
|
Gems repository: http://rubygems.org/gems/color_echo
|
@@ -165,11 +165,29 @@ This method is available in v0.2.0 on and after.
|
|
165
165
|
|
166
166
|
|
167
167
|
### Can to select 256 colors!
|
168
|
-
Please install color_echo and do `
|
168
|
+
Please install color_echo and do `color_echo -l`.
|
169
169
|
ex.) CE.ch :index197, :index230
|
170
170
|

|
171
171
|

|
172
172
|
|
173
|
+
### You can run on the command line
|
174
|
+
<pre>
|
175
|
+
* Usage
|
176
|
+
color_echo [options]
|
177
|
+
|
178
|
+
* Options
|
179
|
+
-v:
|
180
|
+
Display version of color_echo.
|
181
|
+
|
182
|
+
--symbol_list, -s
|
183
|
+
Display symbol list that can to specify.
|
184
|
+
|
185
|
+
--index_list, -l
|
186
|
+
Display color index list that can to specify.
|
187
|
+
|
188
|
+
If your server using the rbenv, You have to do `rbenv rehash`.
|
189
|
+
This is available in v0.6.0 on and after.
|
190
|
+
</pre>
|
173
191
|
|
174
192
|
### Example
|
175
193
|
```ruby
|
@@ -257,8 +275,11 @@ puts "Disable rainbow mode."
|
|
257
275
|

|
258
276
|
|
259
277
|
## Release Note
|
278
|
+
* v0.6.0, 2014-01-05
|
279
|
+
* Added command line tool.
|
280
|
+
|
260
281
|
* v0.5.0, 2014-12-16
|
261
|
-
*
|
282
|
+
* Added a new method -> \#once, \#times
|
262
283
|
|
263
284
|
* v0.4.0, 2014-12-11
|
264
285
|
* Can to select 256 colors.
|
@@ -266,7 +287,7 @@ puts "Disable rainbow mode."
|
|
266
287
|
* v0.3.0, 2014-12-08
|
267
288
|
* High color can now be selected.
|
268
289
|
* Multiple text attribute can now be selected.
|
269
|
-
*
|
290
|
+
* Added parameter to the #reset method.
|
270
291
|
|
271
292
|
* v0.2.4, 2014-12-04
|
272
293
|
* Can now be able to specify a non-string when rainbow mode.
|
data/bin/color_echo
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "color_echo"
|
3
|
+
#require_relative "../lib/color_echo.rb"
|
4
|
+
|
5
|
+
def usage
|
6
|
+
CE.ch :yellow
|
7
|
+
puts <<EOS
|
8
|
+
#{CE::LIBS_NAME} - #{CE::SUMMARY}
|
9
|
+
VERSION: #{CE::VERSION}
|
10
|
+
README: #{CE::DOCS_PAGE}
|
11
|
+
|
12
|
+
EOS
|
13
|
+
|
14
|
+
CE.once.ch :cyan
|
15
|
+
puts <<EOS
|
16
|
+
* Usage
|
17
|
+
EOS
|
18
|
+
|
19
|
+
CE.once.ch :h_blue
|
20
|
+
puts <<EOS
|
21
|
+
color_echo [-h] [options]
|
22
|
+
|
23
|
+
EOS
|
24
|
+
|
25
|
+
CE.once.ch :cyan
|
26
|
+
puts <<EOS
|
27
|
+
* Options
|
28
|
+
EOS
|
29
|
+
|
30
|
+
CE.once.ch :h_green
|
31
|
+
puts <<EOS
|
32
|
+
-v:
|
33
|
+
EOS
|
34
|
+
|
35
|
+
puts <<EOS
|
36
|
+
Display version of color_echo.
|
37
|
+
|
38
|
+
EOS
|
39
|
+
|
40
|
+
CE.once.ch :h_green
|
41
|
+
puts <<EOS
|
42
|
+
--symbol_list, -s
|
43
|
+
EOS
|
44
|
+
|
45
|
+
puts <<EOS
|
46
|
+
Display symbol list that can to specify.
|
47
|
+
EOS
|
48
|
+
|
49
|
+
CE.once.ch :h_green
|
50
|
+
puts <<EOS
|
51
|
+
|
52
|
+
--index_list, -l
|
53
|
+
EOS
|
54
|
+
|
55
|
+
puts <<EOS
|
56
|
+
Display color index list that can to specify.
|
57
|
+
|
58
|
+
EOS
|
59
|
+
|
60
|
+
exit
|
61
|
+
end
|
62
|
+
|
63
|
+
def display_color_index
|
64
|
+
CE.rainbow
|
65
|
+
cnt = 134
|
66
|
+
padding = " " * 2
|
67
|
+
mes = "OK, Let me check color index list... :)"
|
68
|
+
puts padding + "-" * cnt
|
69
|
+
puts padding + " " * ((cnt - mes.size)/2) + mes
|
70
|
+
puts padding + "-" * cnt
|
71
|
+
|
72
|
+
print padding
|
73
|
+
256.times do |i|
|
74
|
+
num = i + 1
|
75
|
+
CE.fg "index#{num}".intern
|
76
|
+
print "index#{num}" + " " * (4 - num.to_s.size)
|
77
|
+
CE.bg "index#{num}".intern
|
78
|
+
print " " * 5
|
79
|
+
CE.off
|
80
|
+
print " " * 3
|
81
|
+
|
82
|
+
if num % 8 == 0
|
83
|
+
print $/ + $/
|
84
|
+
print padding if num != 256
|
85
|
+
end
|
86
|
+
end
|
87
|
+
CE.off
|
88
|
+
end
|
89
|
+
|
90
|
+
def display_symbol_list
|
91
|
+
symbols = [
|
92
|
+
:black,
|
93
|
+
:gray,
|
94
|
+
:red,
|
95
|
+
:h_red,
|
96
|
+
:green,
|
97
|
+
:h_green,
|
98
|
+
:yellow,
|
99
|
+
:h_yellow,
|
100
|
+
:blue,
|
101
|
+
:h_blue,
|
102
|
+
:magenta,
|
103
|
+
:h_magenta,
|
104
|
+
:cyan,
|
105
|
+
:h_cyan,
|
106
|
+
:white,
|
107
|
+
:h_white,
|
108
|
+
]
|
109
|
+
|
110
|
+
CE.rainbow
|
111
|
+
cnt = 60
|
112
|
+
padding = " " * 2
|
113
|
+
mes = "OK, Let me check color name list... :)"
|
114
|
+
puts padding + "-" * cnt
|
115
|
+
puts padding + " " * ((cnt - mes.size)/2) + mes
|
116
|
+
puts padding + "-" * cnt
|
117
|
+
|
118
|
+
symbols.each do |color_name|
|
119
|
+
CE.off(:bg).fg color_name
|
120
|
+
print "#{padding}:#{color_name}" + " " * (11 - color_name.to_s.size)
|
121
|
+
CE.bg color_name
|
122
|
+
puts color_name.to_s + " " * (30 - color_name.to_s.size)
|
123
|
+
end
|
124
|
+
|
125
|
+
CE.off
|
126
|
+
print $/
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
usage if ARGV.size != 1
|
131
|
+
|
132
|
+
case ARGV[0]
|
133
|
+
when "--symbol_list", "-s"
|
134
|
+
display_symbol_list
|
135
|
+
|
136
|
+
when "--index_list", "-l"
|
137
|
+
display_color_index
|
138
|
+
|
139
|
+
when "-v"
|
140
|
+
puts CE::VERSION
|
141
|
+
|
142
|
+
else
|
143
|
+
usage
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
|
data/lib/color_echo.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# color_echo
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# Decorate the command line output with ANSI escape sequense.
|
4
4
|
# This Library will extend the Kernel module's functions(#print, #puts, #p).
|
5
5
|
# Required StringIO.
|
6
6
|
#
|
@@ -10,11 +10,11 @@ rescue LoadError
|
|
10
10
|
warn "color_echo required 'stringio'."
|
11
11
|
end
|
12
12
|
|
13
|
-
require_relative "color_echo/
|
14
|
-
require_relative "color_echo/foreground.
|
15
|
-
require_relative "color_echo/background.
|
16
|
-
require_relative "color_echo/textattr.
|
17
|
-
require_relative "color_echo/off.
|
13
|
+
require_relative "color_echo/const.rb"
|
14
|
+
require_relative "color_echo/module/foreground.rb"
|
15
|
+
require_relative "color_echo/module/background.rb"
|
16
|
+
require_relative "color_echo/module/textattr.rb"
|
17
|
+
require_relative "color_echo/module/off.rb"
|
18
18
|
require_relative "color_echo/variables.rb"
|
19
19
|
require_relative "color_echo/module_functions.rb"
|
20
20
|
require_relative "color_echo/override.rb"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module CE
|
2
|
+
LIBS_NAME = "color_echo"
|
3
|
+
VERSION = "0.6.0"
|
4
|
+
SUMMARY = "Decorate the command line output with ANSI escape sequence."
|
5
|
+
DOCS_PAGE = "https://github.com/khotta/color_echo"
|
6
|
+
DESCRIPTION = <<EOS
|
7
|
+
#{SUMMARY}
|
8
|
+
This Library will extend the Kernel module's functions(#print, #puts, #p).
|
9
|
+
Required StringIO.
|
10
|
+
EOS
|
11
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,37 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: color_echo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- khotta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
|
-
|
14
|
+
Decorate the command line output with ANSI escape sequence.
|
15
15
|
This Library will extend the Kernel module's functions(#print, #puts, #p).
|
16
16
|
Required StringIO.
|
17
|
-
email:
|
18
|
-
|
19
|
-
|
17
|
+
email:
|
18
|
+
executables:
|
19
|
+
- color_echo
|
20
20
|
extensions: []
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
23
|
- LICENSE.txt
|
24
24
|
- README.md
|
25
|
+
- bin/color_echo
|
25
26
|
- lib/color_echo.rb
|
26
27
|
- lib/color_echo/alias_method.rb
|
27
|
-
- lib/color_echo/
|
28
|
-
- lib/color_echo/
|
28
|
+
- lib/color_echo/const.rb
|
29
|
+
- lib/color_echo/module/background.rb
|
30
|
+
- lib/color_echo/module/foreground.rb
|
31
|
+
- lib/color_echo/module/off.rb
|
32
|
+
- lib/color_echo/module/textattr.rb
|
29
33
|
- lib/color_echo/module_functions.rb
|
30
|
-
- lib/color_echo/off.module.rb
|
31
34
|
- lib/color_echo/override.rb
|
32
|
-
- lib/color_echo/textattr.module.rb
|
33
35
|
- lib/color_echo/variables.rb
|
34
|
-
- lib/color_echo/version.rb
|
35
36
|
homepage: https://github.com/khotta/color_echo
|
36
37
|
licenses:
|
37
38
|
- MIT
|
@@ -45,7 +46,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
46
|
requirements:
|
46
47
|
- - ">="
|
47
48
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
+
version: 1.9.3
|
49
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
51
|
requirements:
|
51
52
|
- - ">="
|
@@ -56,5 +57,5 @@ rubyforge_project:
|
|
56
57
|
rubygems_version: 2.2.2
|
57
58
|
signing_key:
|
58
59
|
specification_version: 4
|
59
|
-
summary:
|
60
|
+
summary: Decorate the command line output with ANSI escape sequence.
|
60
61
|
test_files: []
|
data/lib/color_echo/version.rb
DELETED