Skip to content

Commit

Permalink
Add binary options --print-summary, --print-cache-stats and `--pr…
Browse files Browse the repository at this point in the history
…int-long-checks`
  • Loading branch information
boillodmanuel committed Dec 2, 2020
1 parent 4aa31d4 commit 72112a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased][]

### Added

- Add binary options `--print-summary`, `--print-cache-stats` and `--print-long-checks`

## [4.3.0][] - 2020-12-02

### Added
Expand Down
17 changes: 9 additions & 8 deletions src/bin/markdown-link-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ function printInputResult(cmdObj: CmdOptions, result: ProcessInputResults): void
}
console.log(
`[${statusLabel}] ${linkResult.link}` +
(!isOk || cmdObj.verbose ? ` → Status: ${linkResult.statusCode}` : '') +
(cmdObj.verbose ? ` in ${linkResult.stats.durationInMs} ms` : '') +
(linkResult.err ? chalk.red(` (Error: ${linkResult.err})`) : '') +
(linkResult.additionalMessages ? chalk.yellow(` (Warning: ${linkResult.additionalMessages})`) : ''),
(!isOk || cmdObj.verbose ? ` → Status: ${linkResult.statusCode}` : '') +
(cmdObj.verbose ? ` in ${linkResult.stats.durationInMs} ms` : '') +
(linkResult.err ? chalk.red(` (Error: ${linkResult.err})`) : '') +
(linkResult.additionalMessages ? chalk.yellow(` (Warning: ${linkResult.additionalMessages})`) : ''),
)
}

Expand Down Expand Up @@ -261,10 +261,11 @@ function printLongChecksInput(cmdObj: CmdOptions, result: ProcessInputResults):
break
}
if (linkResult.stats.durationInMs && linkResult.stats.durationInMs > cmdObj.longChecksMaxDuration) {
console.log(`- ${linkResult.link}: ` +
((linkResult.stats.durationInMs > cmdObj.longChecksMaxDuration * 10) ?
chalk.red(`${linkResult.stats.durationInMs} ms (> 10x)`) :
chalk.yellow(`${linkResult.stats.durationInMs} ms`))
console.log(
`- ${linkResult.link}: ` +
(linkResult.stats.durationInMs > cmdObj.longChecksMaxDuration * 10
? chalk.red(`${linkResult.stats.durationInMs} ms (> 10x)`)
: chalk.yellow(`${linkResult.stats.durationInMs} ms`)),
)
}
}
Expand Down

0 comments on commit 72112a0

Please sign in to comment.