From 311845151a7126d76fb40b74d48737894ae83b26 Mon Sep 17 00:00:00 2001 From: Frederik Hjorslev Poulsen Date: Mon, 6 Apr 2020 12:55:12 +0200 Subject: [PATCH] :art: (Analyze dead links): Prettier output Make a headline named 'Dead links found' and add each dead link on a new line --- DeadLinksAnalyzer.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DeadLinksAnalyzer.ps1 b/DeadLinksAnalyzer.ps1 index ec4c08c..87a4120 100644 --- a/DeadLinksAnalyzer.ps1 +++ b/DeadLinksAnalyzer.ps1 @@ -1,7 +1,7 @@ function Test-MarkdownLinks([String]$Path) { $unreachable = @() # Get markdown files recursively - $files = Get-ChildItem -Path $path -Recurse -Include "*.md" + $files = Get-ChildItem -Path $Path -Recurse -Include "*.md" $files | ForEach-Object { $fileName = $_.Name @@ -26,7 +26,11 @@ return $unreachable } -$deadlinks = Test-MarkdownLinks -Path ".\readme.md" -if ($deadlinks) { - Write-Error -Message 'Dead links found' -Category ObjectNotFound +$DeadLinks = Test-MarkdownLinks -Path ".\readme.md" +if ($DeadLinks) { + Write-Host -Object '--- DEAD LINKS FOUND ---' -ForegroundColor Red + foreach ($DeadLink in $DeadLinks) { + Write-Host -Object $DeadLink -ForegroundColor Red + } + exit 1 } \ No newline at end of file