This repository was archived by the owner on Sep 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
Original file line number Diff line number Diff line change @@ -74,5 +74,9 @@ module.exports = {
74
74
flag : true ,
75
75
help : "asynchronously read/write files in directory (faster)" ,
76
76
hidden : true
77
+ } ,
78
+ noColor : {
79
+ help : 'Disable color output.' ,
80
+ flag : true
77
81
}
78
- }
82
+ } ;
Original file line number Diff line number Diff line change @@ -150,9 +150,11 @@ module.exports = function(options) {
150
150
}
151
151
152
152
if ( ! options . silent ) {
153
- var printout = file [ options . fileColor ] || file ;
153
+ var printout = options . noColor ? file : file [ options . fileColor ] || file ;
154
154
if ( options . count ) {
155
- printout += ( " (" + match . length + ")" ) . grey ;
155
+ var count = " (" + match . length + ")" ;
156
+ count = options . noColor ? count : count . grey ;
157
+ printout += count ;
156
158
}
157
159
console . log ( printout ) ;
158
160
}
@@ -167,7 +169,10 @@ module.exports = function(options) {
167
169
break ;
168
170
}
169
171
var replacement = options . replacement || "$&" ;
170
- line = line . replace ( regex , replaceFunc || replacement [ options . color ] ) ;
172
+ if ( ! options . noColor ) {
173
+ replacement = replacement [ options . color ] ;
174
+ }
175
+ line = line . replace ( regex , replaceFunc || replacement ) ;
171
176
console . log ( " " + ( i + 1 ) + ": " + line . slice ( 0 , limit ) ) ;
172
177
}
173
178
}
You can’t perform that action at this time.
0 commit comments