()
| 302 | } |
| 303 | |
| 304 | function run() { |
| 305 | let files = []; |
| 306 | |
| 307 | program |
| 308 | .usage("[options] <file ...>") |
| 309 | .arguments("[file...]") |
| 310 | .action(_files => (files = _files)) |
| 311 | .option("-q, --quiet", "Quiet mode. Show only results. Don't show progress") |
| 312 | .option("-t, --target [target]", "Output target (TERM|MD)") |
| 313 | .option( |
| 314 | "-c, --copy [copymode]", |
| 315 | "[boolean] Copy mode. Gather results before printing", |
| 316 | copy => copy === "1" || copy.toLowerCase() === "true" |
| 317 | ) |
| 318 | .parse(process.argv); |
| 319 | |
| 320 | DEBUG = !program.quiet; |
| 321 | |
| 322 | const prepare = |
| 323 | files.length > 0 |
| 324 | ? Promise.resolve(files) |
| 325 | : new AssetsManager(DEFAULT_ASSETS, ASSETS_DIR).updateCache(); |
| 326 | |
| 327 | prepare |
| 328 | .then(files => { |
| 329 | const benchmark = new Benchmark(files); |
| 330 | if (DEBUG) console.error("Running Benchmarks..."); |
| 331 | |
| 332 | if (program.copy) { |
| 333 | benchmark.run(); |
| 334 | for (const result of benchmark.results) { |
| 335 | new Printer(result, program.target).print(); |
| 336 | } |
| 337 | } else { |
| 338 | benchmark.runAndPrint(program.target); |
| 339 | } |
| 340 | }) |
| 341 | .catch(e => { |
| 342 | console.error(e); |
| 343 | process.exit(1); |
| 344 | }); |
| 345 | } |
| 346 | |
| 347 | run(); |
no test coverage detected