Skip to content

Commit

Permalink
Merge pull request #164 from brandones/indent-only
Browse files Browse the repository at this point in the history
Indent console output for each file
  • Loading branch information
tcort authored Nov 24, 2021
2 parents 9c222c9 + a29313f commit bcf1f6a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions markdown-link-check
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ stream
function runMarkdownLinkCheck(markdown, opts) {
markdownLinkCheck(markdown, opts, function (err, results) {
if (err) {
console.error(chalk.red('\nERROR: something went wrong!'));
console.error(chalk.red('\n ERROR: something went wrong!'));
console.error(err.stack);
process.exit(1);
}

if (results.length === 0 && !opts.quiet) {
console.log(chalk.yellow('No hyperlinks found!'));
console.log(chalk.yellow(' No hyperlinks found!'));
}
results.forEach(function (result) {
// Skip messages for non-deadlinks in quiet mode.
Expand All @@ -157,21 +157,21 @@ function runMarkdownLinkCheck(markdown, opts) {

if (opts.verbose) {
if (result.err) {
console.log('[%s] %s → Status: %s %s', statusLabels[result.status], result.link, result.statusCode, result.err);
console.log(' [%s] %s → Status: %s %s', statusLabels[result.status], result.link, result.statusCode, result.err);
} else {
console.log('[%s] %s → Status: %s', statusLabels[result.status], result.link, result.statusCode);
console.log(' [%s] %s → Status: %s', statusLabels[result.status], result.link, result.statusCode);
}
}
else {
console.log('[%s] %s', statusLabels[result.status], result.link);
console.log(' [%s] %s', statusLabels[result.status], result.link);
}
});
console.log('\n%s links checked.', results.length);
console.log('\n %s links checked.', results.length);
if (results.some((result) => result.status === 'dead')) {
let deadLinks = results.filter(result => { return result.status === 'dead'; });
console.error(chalk.red('\nERROR: %s dead links found!'), deadLinks.length);
console.error(chalk.red('\n ERROR: %s dead links found!'), deadLinks.length);
deadLinks.forEach(function (result) {
console.log('[%s] %s → Status: %s', statusLabels[result.status], result.link, result.statusCode);
console.log(' [%s] %s → Status: %s', statusLabels[result.status], result.link, result.statusCode);
});
process.exit(1);
}
Expand Down

0 comments on commit bcf1f6a

Please sign in to comment.