Skip to content

Commit

Permalink
Add a status line at the end of execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Lotes committed May 29, 2024
1 parent 7f44c4f commit 855acc3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/check-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ async function main() {
const markdownFiles = await readMarkdownFiles();
const setOfUrls = classifyAsDocumentLinksOrAliases(markdownFiles);
//await writeFile("existingLinks.txt", JSON.stringify([...setOfUrls.entries()], null, 2));
return printMissingLinks(markdownFiles, setOfUrls);
const success = printMissingLinks(markdownFiles, setOfUrls);
if(success) {
console.log(chalk.greenBright('Success!'));
process.exit(0);
} else {
console.log(chalk.redBright('Failed!'));
process.exit(1);
}
}

function classifyAsDocumentLinksOrAliases(markdownFiles: MarkdownFile[]) {
Expand Down Expand Up @@ -130,4 +137,4 @@ function urlToString(link: string): string {
return url.toString();
}

main().then(success => process.exit(success ? 0 : 1));
main();

0 comments on commit 855acc3

Please sign in to comment.