colsole 0.1.3.pre → 0.1.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/colsole.rb +4 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e64bba685abbdc9b44bde978b040658f4ca6349b
|
4
|
+
data.tar.gz: 03d5b1228531560b7b6e81cc03bcc52c57686c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8005f6be2991744f90b3f74e2d06ea488695f05e88993a2242457e785777877f6bc0947b8f73e3514e5945a07924c61af8fece3414c2a0de3b9cdb40074e3330
|
7
|
+
data.tar.gz: 2671a6ba76b6ac9a3f8e5c5a7840bf21d2a053d286fda0a083ecbc78f7e6c2cc284a399fdfa1bff90d92ffe24646145697c8eacfd4c0aa8dd92f08a4de8c75ed
|
data/lib/colsole.rb
CHANGED
@@ -22,7 +22,7 @@ module Colsole
|
|
22
22
|
if last == ' ' or last == '\t'
|
23
23
|
print colorize text, force_color
|
24
24
|
else
|
25
|
-
print colorize "#{text}
|
25
|
+
print colorize "#{text}\n", force_color;
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -60,9 +60,6 @@ module Colsole
|
|
60
60
|
# Converts a long string to be wrapped.
|
61
61
|
# If the string starts with one or more spaces, they will be
|
62
62
|
# preserved in all subsequent lines (i.e., remain indented).
|
63
|
-
#--
|
64
|
-
# TODO: this is currently not word wrap, but just wrap.
|
65
|
-
# either rename or redo
|
66
63
|
def word_wrap(str, length=80, character=$/)
|
67
64
|
lead = str[/^\s+/]
|
68
65
|
length -= lead.size
|
@@ -121,16 +118,15 @@ module Colsole
|
|
121
118
|
esc = 27.chr
|
122
119
|
reset = esc + colors['txtrst']
|
123
120
|
if is_terminal or force_color
|
124
|
-
reset_called_last =
|
121
|
+
reset_called_last = true
|
125
122
|
|
126
|
-
out = text.gsub
|
123
|
+
out = text.gsub(/\!([a-z]{6})\!/) do |m|
|
127
124
|
reset_called_last = $1 == "txtrst";
|
128
125
|
esc + colors[$1];
|
129
126
|
end
|
130
|
-
|
131
127
|
reset_called_last or out = "#{out}#{reset}";
|
132
128
|
else
|
133
|
-
out = text.gsub
|
129
|
+
out = text.gsub(/\!([a-z]{6})\!/, '')
|
134
130
|
end
|
135
131
|
|
136
132
|
return out
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colsole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
@@ -17,7 +17,7 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/colsole.rb
|
20
|
-
homepage:
|
20
|
+
homepage: https://github.com/DannyBen/colsole
|
21
21
|
licenses:
|
22
22
|
- MIT
|
23
23
|
metadata: {}
|