nanoc-cli 4.13.3 → 4.13.5
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/lib/nanoc/cli/ansi_string_colorizer.rb +24 -4
- data/lib/nanoc/cli/cleaning_stream.rb +17 -70
- data/lib/nanoc/cli/commands/nanoc.rb +2 -4
- data/lib/nanoc/cli/commands/show-data.rb +6 -6
- data/lib/nanoc/cli/compile_listeners/debug_printer.rb +11 -7
- data/lib/nanoc/cli/error_handler.rb +6 -4
- data/lib/nanoc/cli/logger.rb +18 -22
- data/lib/nanoc/cli/version.rb +1 -1
- data/lib/nanoc/cli.rb +23 -24
- metadata +20 -10
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90693f6d82a8c891f00eef0c9a278aea65cd2d34438a54da8d0b0178090ecc82
|
4
|
+
data.tar.gz: 9abcbdcb6c42399ebbfa66363b3dc14d8a7ccc0979cbe5402262a1fc60ba05af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5916c0fe675ceb20d1c5f98c0d893ce67a1e467091c76b3623f94448480dc294f64a618840f38c5c51c4545d280fcf77330c1cb90d1b2fe1d07c8f95391992c9
|
7
|
+
data.tar.gz: 917d7976b55aa59b2c00d3a0c41492af724ef2b5970d68a38663485c68a2ded4b93787533110f6923f9ec65ea83d067ac3beccbbf0879ac4c28a3f1024418a91
|
@@ -6,24 +6,44 @@ module Nanoc
|
|
6
6
|
# attributes, it returns a colorized string.
|
7
7
|
#
|
8
8
|
# @api private
|
9
|
-
|
10
|
-
|
9
|
+
class ANSIStringColorizer
|
10
|
+
CLEAR = "\e[0m"
|
11
|
+
|
11
12
|
MAPPING = {
|
12
13
|
bold: "\e[1m",
|
14
|
+
|
15
|
+
black: "\e[30m",
|
13
16
|
red: "\e[31m",
|
14
17
|
green: "\e[32m",
|
15
18
|
yellow: "\e[33m",
|
16
19
|
blue: "\e[34m",
|
20
|
+
magenta: "\e[35m",
|
21
|
+
cyan: "\e[36m",
|
22
|
+
white: "\e[37m",
|
17
23
|
}.freeze
|
18
24
|
|
25
|
+
def initialize(io)
|
26
|
+
@io = io
|
27
|
+
end
|
28
|
+
|
29
|
+
def enabled?
|
30
|
+
return @_enabled if defined?(@_enabled)
|
31
|
+
|
32
|
+
@_enabled = Nanoc::CLI.enable_ansi_colors?(@io)
|
33
|
+
end
|
34
|
+
|
19
35
|
# @param [String] str The string to colorize
|
20
36
|
#
|
21
37
|
# @param [Array] attrs An array of attributes from `MAPPING` to colorize the
|
22
38
|
# string with
|
23
39
|
#
|
24
40
|
# @return [String] A string colorized using the given attributes
|
25
|
-
def
|
26
|
-
|
41
|
+
def c(str, *attrs)
|
42
|
+
if enabled?
|
43
|
+
attrs.map { |a| MAPPING[a] }.join('') + str + CLEAR
|
44
|
+
else
|
45
|
+
str
|
46
|
+
end
|
27
47
|
end
|
28
48
|
end
|
29
49
|
end
|
@@ -5,6 +5,23 @@ module Nanoc
|
|
5
5
|
# An output stream that passes output through stream cleaners. This can be
|
6
6
|
# used to strip ANSI color sequences, for instance.
|
7
7
|
class CleaningStream
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def_delegator :@stream, :close
|
11
|
+
def_delegator :@stream, :closed?
|
12
|
+
def_delegator :@stream, :exist?
|
13
|
+
def_delegator :@stream, :exists?
|
14
|
+
def_delegator :@stream, :external_encoding
|
15
|
+
def_delegator :@stream, :printf
|
16
|
+
def_delegator :@stream, :reopen
|
17
|
+
def_delegator :@stream, :set_encoding
|
18
|
+
def_delegator :@stream, :string
|
19
|
+
def_delegator :@stream, :sync
|
20
|
+
def_delegator :@stream, :sync=
|
21
|
+
def_delegator :@stream, :tell
|
22
|
+
def_delegator :@stream, :winsize
|
23
|
+
def_delegator :@stream, :winsize=
|
24
|
+
|
8
25
|
# @param [IO, StringIO] stream The stream to wrap
|
9
26
|
def initialize(stream)
|
10
27
|
@stream = stream
|
@@ -69,11 +86,6 @@ module Nanoc
|
|
69
86
|
end
|
70
87
|
end
|
71
88
|
|
72
|
-
# @see IO#tell
|
73
|
-
def tell
|
74
|
-
@stream.tell
|
75
|
-
end
|
76
|
-
|
77
89
|
# @see IO#print
|
78
90
|
def print(str)
|
79
91
|
_nanoc_swallow_broken_pipe_errors_while do
|
@@ -81,11 +93,6 @@ module Nanoc
|
|
81
93
|
end
|
82
94
|
end
|
83
95
|
|
84
|
-
# @see IO#printf
|
85
|
-
def printf(*args)
|
86
|
-
@stream.printf(*args)
|
87
|
-
end
|
88
|
-
|
89
96
|
# @see IO#puts
|
90
97
|
def puts(*str)
|
91
98
|
_nanoc_swallow_broken_pipe_errors_while do
|
@@ -93,66 +100,6 @@ module Nanoc
|
|
93
100
|
end
|
94
101
|
end
|
95
102
|
|
96
|
-
# @see StringIO#string
|
97
|
-
def string
|
98
|
-
@stream.string
|
99
|
-
end
|
100
|
-
|
101
|
-
# @see IO#reopen
|
102
|
-
def reopen(*args)
|
103
|
-
@stream.reopen(*args)
|
104
|
-
end
|
105
|
-
|
106
|
-
# @see IO#close
|
107
|
-
def close
|
108
|
-
@stream.close
|
109
|
-
end
|
110
|
-
|
111
|
-
# @see IO#closed?
|
112
|
-
def closed?
|
113
|
-
@stream.closed?
|
114
|
-
end
|
115
|
-
|
116
|
-
# @see File#exist?
|
117
|
-
def exist?
|
118
|
-
@stream.exist?
|
119
|
-
end
|
120
|
-
|
121
|
-
# @see File.exists?
|
122
|
-
def exists?
|
123
|
-
@stream.exists?
|
124
|
-
end
|
125
|
-
|
126
|
-
# @see IO.winsize
|
127
|
-
def winsize
|
128
|
-
@stream.winsize
|
129
|
-
end
|
130
|
-
|
131
|
-
# @see IO.winsize=
|
132
|
-
def winsize=(arg)
|
133
|
-
@stream.winsize = arg
|
134
|
-
end
|
135
|
-
|
136
|
-
# @see IO.sync
|
137
|
-
def sync
|
138
|
-
@stream.sync
|
139
|
-
end
|
140
|
-
|
141
|
-
# @see IO.sync=
|
142
|
-
def sync=(arg)
|
143
|
-
@stream.sync = arg
|
144
|
-
end
|
145
|
-
|
146
|
-
# @see IO.sync=
|
147
|
-
def external_encoding
|
148
|
-
@stream.external_encoding
|
149
|
-
end
|
150
|
-
|
151
|
-
# @see ARGF.set_encoding
|
152
|
-
def set_encoding(*args)
|
153
|
-
@stream.set_encoding(*args)
|
154
|
-
end
|
155
|
-
|
156
103
|
protected
|
157
104
|
|
158
105
|
def _nanoc_clean(str)
|
@@ -5,8 +5,7 @@ summary 'Nanoc, a static site compiler written in Ruby'
|
|
5
5
|
default_subcommand 'compile'
|
6
6
|
|
7
7
|
opt :l, :color, 'enable color' do
|
8
|
-
|
9
|
-
$stderr.remove_stream_cleaner(Nanoc::CLI::StreamCleaners::ANSIColors)
|
8
|
+
Nanoc::CLI.force_color = Nanoc::CLI::FORCE_COLOR_ENABLED
|
10
9
|
end
|
11
10
|
|
12
11
|
opt :d, :debug, 'enable debugging' do
|
@@ -23,8 +22,7 @@ opt :h, :help, 'show the help message and quit' do |_value, cmd|
|
|
23
22
|
end
|
24
23
|
|
25
24
|
opt :C, :'no-color', 'disable color' do
|
26
|
-
|
27
|
-
$stderr.add_stream_cleaner(Nanoc::CLI::StreamCleaners::ANSIColors)
|
25
|
+
Nanoc::CLI.force_color = Nanoc::CLI::FORCE_COLOR_DISABLED
|
28
26
|
end
|
29
27
|
|
30
28
|
opt :V, :verbose, 'make output more detailed', multiple: true do |val|
|
@@ -120,7 +120,7 @@ module Nanoc::CLI::Commands
|
|
120
120
|
if pred
|
121
121
|
print " [ #{format '%7s', type} ] (#{dep.props})"
|
122
122
|
|
123
|
-
|
123
|
+
unless details.empty?
|
124
124
|
print ' '
|
125
125
|
end
|
126
126
|
|
@@ -139,7 +139,7 @@ module Nanoc::CLI::Commands
|
|
139
139
|
case dep.props.raw_content
|
140
140
|
when true
|
141
141
|
outcome << 'matching any identifier'
|
142
|
-
when Set
|
142
|
+
when Set, Array
|
143
143
|
dep.props.raw_content.sort.each do |x|
|
144
144
|
outcome << "matching identifier #{x}"
|
145
145
|
end
|
@@ -149,7 +149,7 @@ module Nanoc::CLI::Commands
|
|
149
149
|
case dep.props.attributes
|
150
150
|
when true
|
151
151
|
outcome << 'matching any attribute'
|
152
|
-
when Set
|
152
|
+
when Set, Array
|
153
153
|
dep.props.attributes.each do |elem|
|
154
154
|
case elem
|
155
155
|
when Symbol
|
@@ -214,13 +214,13 @@ module Nanoc::CLI::Commands
|
|
214
214
|
|
215
215
|
def print_outdatedness_reasons_for(obj, outdatedness_checker)
|
216
216
|
reasons = outdatedness_checker.outdatedness_reasons_for(obj)
|
217
|
-
if reasons.
|
217
|
+
if reasons.empty?
|
218
|
+
puts ' is not outdated'
|
219
|
+
else
|
218
220
|
puts ' is outdated:'
|
219
221
|
reasons.each do |reason|
|
220
222
|
puts " - #{reason.message}"
|
221
223
|
end
|
222
|
-
else
|
223
|
-
puts ' is not outdated'
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
@@ -8,12 +8,12 @@ module Nanoc::CLI::CompileListeners
|
|
8
8
|
end
|
9
9
|
|
10
10
|
COLOR_MAP = {
|
11
|
-
'compilation' =>
|
12
|
-
'content' =>
|
13
|
-
'filtering' =>
|
14
|
-
'dependency_tracking' =>
|
15
|
-
'phase' =>
|
16
|
-
'stage' =>
|
11
|
+
'compilation' => :red,
|
12
|
+
'content' => :green,
|
13
|
+
'filtering' => :yellow,
|
14
|
+
'dependency_tracking' => :blue,
|
15
|
+
'phase' => :magenta,
|
16
|
+
'stage' => :cyan,
|
17
17
|
}.freeze
|
18
18
|
|
19
19
|
# @see Listener#start
|
@@ -92,9 +92,13 @@ module Nanoc::CLI::CompileListeners
|
|
92
92
|
@_logger ||=
|
93
93
|
Logger.new($stdout).tap do |l|
|
94
94
|
l.formatter = proc do |_severity, datetime, progname, msg|
|
95
|
-
"*** #{datetime.strftime('%H:%M:%S.%L')} #{COLOR_MAP[progname]}
|
95
|
+
"*** #{datetime.strftime('%H:%M:%S.%L')} #{colorizer.c(msg, COLOR_MAP[progname])}\n"
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
def colorizer
|
101
|
+
@_colorizer ||= Nanoc::CLI::ANSIStringColorizer.new($stdout)
|
102
|
+
end
|
99
103
|
end
|
100
104
|
end
|
@@ -107,9 +107,7 @@ module Nanoc::CLI
|
|
107
107
|
write_compact_error(error, $stderr)
|
108
108
|
|
109
109
|
File.open('crash.log', 'w') do |io|
|
110
|
-
|
111
|
-
cio.add_stream_cleaner(::Nanoc::CLI::StreamCleaners::ANSIColors)
|
112
|
-
write_verbose_error(error, cio)
|
110
|
+
write_verbose_error(error, io)
|
113
111
|
end
|
114
112
|
end
|
115
113
|
|
@@ -289,7 +287,7 @@ module Nanoc::CLI
|
|
289
287
|
|
290
288
|
message = "#{error.class}: #{message_for_error(error)}"
|
291
289
|
unless verbose
|
292
|
-
message =
|
290
|
+
message = colorizer_for(stream).c(message, :bold, :red)
|
293
291
|
end
|
294
292
|
stream.puts message
|
295
293
|
resolution = resolution_for(error)
|
@@ -363,6 +361,10 @@ module Nanoc::CLI
|
|
363
361
|
end
|
364
362
|
end
|
365
363
|
|
364
|
+
def colorizer_for(io)
|
365
|
+
Nanoc::CLI::ANSIStringColorizer.new(io)
|
366
|
+
end
|
367
|
+
|
366
368
|
def unwrap_error(e)
|
367
369
|
case e
|
368
370
|
when Nanoc::Core::Errors::CompilationError
|
data/lib/nanoc/cli/logger.rb
CHANGED
@@ -7,15 +7,13 @@ module Nanoc
|
|
7
7
|
#
|
8
8
|
# @api private
|
9
9
|
class Logger
|
10
|
-
# Maps actions (`:create`, `:update`, `:identical`, `:cached`, `:skip` and `:delete`)
|
11
|
-
# onto their ANSI color codes.
|
12
10
|
ACTION_COLORS = {
|
13
|
-
create:
|
14
|
-
update:
|
15
|
-
identical:
|
16
|
-
cached:
|
17
|
-
skip:
|
18
|
-
delete:
|
11
|
+
create: [:green],
|
12
|
+
update: [:yellow],
|
13
|
+
identical: [],
|
14
|
+
cached: [],
|
15
|
+
skip: [],
|
16
|
+
delete: [:red],
|
19
17
|
}.freeze
|
20
18
|
|
21
19
|
include Singleton
|
@@ -42,17 +40,17 @@ module Nanoc
|
|
42
40
|
#
|
43
41
|
# @return [void]
|
44
42
|
def file(level, action, name, duration = nil)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
name,
|
54
|
-
),
|
43
|
+
colorizer = Nanoc::CLI::ANSIStringColorizer.new($stdout)
|
44
|
+
colored_action = colorizer.c(action.to_s, *ACTION_COLORS[action.to_sym])
|
45
|
+
|
46
|
+
message = format(
|
47
|
+
'%12s %s%s',
|
48
|
+
colored_action,
|
49
|
+
duration.nil? ? '' : format('[%2.2fs] ', duration),
|
50
|
+
name,
|
55
51
|
)
|
52
|
+
|
53
|
+
log(level, message)
|
56
54
|
end
|
57
55
|
|
58
56
|
# Logs a message.
|
@@ -61,15 +59,13 @@ module Nanoc
|
|
61
59
|
#
|
62
60
|
# @param [String] message The message to be logged
|
63
61
|
#
|
64
|
-
# @param [#puts] io The stream to which the message should be written
|
65
|
-
#
|
66
62
|
# @return [void]
|
67
|
-
def log(level, message
|
63
|
+
def log(level, message)
|
68
64
|
return if @level == :off
|
69
65
|
return if @level != :low && @level != level
|
70
66
|
|
71
67
|
@mutex.synchronize do
|
72
|
-
|
68
|
+
puts(message)
|
73
69
|
end
|
74
70
|
end
|
75
71
|
end
|
data/lib/nanoc/cli/version.rb
CHANGED
data/lib/nanoc/cli.rb
CHANGED
@@ -16,27 +16,25 @@ end
|
|
16
16
|
module Nanoc
|
17
17
|
# @api private
|
18
18
|
module CLI
|
19
|
-
|
20
|
-
|
21
|
-
@debug || false
|
22
|
-
end
|
19
|
+
FORCE_COLOR_ENABLED = :enabled
|
20
|
+
FORCE_COLOR_DISABLED = :disabled
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
#
|
27
|
-
# @return [void]
|
28
|
-
def self.debug=(boolean)
|
29
|
-
@debug = boolean
|
30
|
-
end
|
22
|
+
class << self
|
23
|
+
attr_accessor :force_color
|
31
24
|
|
32
|
-
|
33
|
-
|
34
|
-
end
|
25
|
+
# true if debug output is enabled, false if not
|
26
|
+
attr_accessor :debug
|
35
27
|
|
36
|
-
|
37
|
-
|
28
|
+
attr_accessor :verbosity
|
29
|
+
|
30
|
+
def debug? = debug
|
38
31
|
end
|
39
32
|
|
33
|
+
# Set default singleton attributes
|
34
|
+
self.force_color = nil
|
35
|
+
self.debug = false
|
36
|
+
self.verbosity = 0
|
37
|
+
|
40
38
|
# Wraps `$stdout` and `$stderr` in appropriate cleaning streams.
|
41
39
|
#
|
42
40
|
# @return [void]
|
@@ -58,10 +56,6 @@ module Nanoc
|
|
58
56
|
cio.add_stream_cleaner(Nanoc::CLI::StreamCleaners::UTF8)
|
59
57
|
end
|
60
58
|
|
61
|
-
unless enable_ansi_colors?(io)
|
62
|
-
cio.add_stream_cleaner(Nanoc::CLI::StreamCleaners::ANSIColors)
|
63
|
-
end
|
64
|
-
|
65
59
|
cio
|
66
60
|
end
|
67
61
|
|
@@ -74,7 +68,14 @@ module Nanoc
|
|
74
68
|
|
75
69
|
# @return [Boolean] true if color support is present, false if not
|
76
70
|
def self.enable_ansi_colors?(io)
|
77
|
-
|
71
|
+
case force_color
|
72
|
+
when FORCE_COLOR_ENABLED
|
73
|
+
true
|
74
|
+
when FORCE_COLOR_DISABLED
|
75
|
+
false
|
76
|
+
else
|
77
|
+
io.tty? && !ENV.key?('NO_COLOR')
|
78
|
+
end
|
78
79
|
end
|
79
80
|
|
80
81
|
# Invokes the Nanoc command-line tool with the given arguments.
|
@@ -166,7 +167,7 @@ module Nanoc
|
|
166
167
|
if Nanoc::Core::SiteLoader.cwd_is_nanoc_site?
|
167
168
|
config = Nanoc::Core::ConfigLoader.new.new_from_cwd
|
168
169
|
config[:commands_dirs].each do |path|
|
169
|
-
load_commands_at(path)
|
170
|
+
load_commands_at(File.expand_path(path))
|
170
171
|
end
|
171
172
|
end
|
172
173
|
end
|
@@ -218,8 +219,6 @@ inflector_class = Class.new(Zeitwerk::Inflector) do
|
|
218
219
|
case basename
|
219
220
|
when 'version', 'cli', 'utf8'
|
220
221
|
basename.upcase
|
221
|
-
when 'ansi_colors'
|
222
|
-
'ANSIColors'
|
223
222
|
when 'ansi_string_colorizer'
|
224
223
|
'ANSIStringColorizer'
|
225
224
|
else
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.13.
|
4
|
+
version: 4.13.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: cri
|
@@ -38,20 +37,34 @@ dependencies:
|
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '1.3'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: logger
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.6'
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.6'
|
41
54
|
- !ruby/object:Gem::Dependency
|
42
55
|
name: nanoc-core
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
44
57
|
requirements:
|
45
58
|
- - '='
|
46
59
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.13.
|
60
|
+
version: 4.13.5
|
48
61
|
type: :runtime
|
49
62
|
prerelease: false
|
50
63
|
version_requirements: !ruby/object:Gem::Requirement
|
51
64
|
requirements:
|
52
65
|
- - '='
|
53
66
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.13.
|
67
|
+
version: 4.13.5
|
55
68
|
- !ruby/object:Gem::Dependency
|
56
69
|
name: pry
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,7 +124,6 @@ files:
|
|
111
124
|
- lib/nanoc/cli/logger.rb
|
112
125
|
- lib/nanoc/cli/stack_trace_writer.rb
|
113
126
|
- lib/nanoc/cli/stream_cleaners/abstract.rb
|
114
|
-
- lib/nanoc/cli/stream_cleaners/ansi_colors.rb
|
115
127
|
- lib/nanoc/cli/stream_cleaners/utf8.rb
|
116
128
|
- lib/nanoc/cli/transform.rb
|
117
129
|
- lib/nanoc/cli/version.rb
|
@@ -120,8 +132,7 @@ licenses:
|
|
120
132
|
- MIT
|
121
133
|
metadata:
|
122
134
|
rubygems_mfa_required: 'true'
|
123
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-cli-v4.13.
|
124
|
-
post_install_message:
|
135
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-cli-v4.13.5/nanoc-cli
|
125
136
|
rdoc_options: []
|
126
137
|
require_paths:
|
127
138
|
- lib
|
@@ -136,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
147
|
- !ruby/object:Gem::Version
|
137
148
|
version: '0'
|
138
149
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
140
|
-
signing_key:
|
150
|
+
rubygems_version: 3.6.7
|
141
151
|
specification_version: 4
|
142
152
|
summary: CLI for Nanoc
|
143
153
|
test_files: []
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module CLI
|
5
|
-
module StreamCleaners
|
6
|
-
# Removes ANSI color escape sequences.
|
7
|
-
class ANSIColors < Abstract
|
8
|
-
# @see Nanoc::CLI::StreamCleaners::Abstract#clean
|
9
|
-
def clean(str)
|
10
|
-
str.gsub(/\e\[.+?m/, '')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|