Skip to content

Commit 24cfc47

Browse files
benchmark: extract 'bold' func for applying ANSI bold code (#2293)
1 parent 47f9e67 commit 24cfc47

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

resources/benchmark.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,7 @@ function matchBenchmarks(patterns) {
282282
}
283283

284284
if (benchmarks.length === 0) {
285-
console.warn(
286-
'No benchmarks matching: ' +
287-
`\u001b[1m${patterns.join('\u001b[0m or \u001b[1m')}\u001b[0m`,
288-
);
285+
console.warn('No benchmarks matching: ' + patterns.map(bold).join(''));
289286
}
290287

291288
return benchmarks;
@@ -312,12 +309,16 @@ function getArguments(argv) {
312309
}
313310
if (assumeArgs) {
314311
console.warn(
315-
`Assuming you meant: \u001b[1mbenchmark ${assumeArgs.join(' ')}\u001b[0m`,
312+
'Assuming you meant: ' + bold('benchmark ' + assumeArgs.join(' ')),
316313
);
317314
}
318315
return { benchmarkPatterns, revisions };
319316
}
320317

318+
function bold(str) {
319+
return '\u001b[1m' + str + '\u001b[0m';
320+
}
321+
321322
// Get the revisions and make things happen!
322323
if (require.main === module) {
323324
const { benchmarkPatterns, revisions } = getArguments(process.argv.slice(2));

0 commit comments

Comments
 (0)