mirror of
https://github.com/janikvonrotz/awesome-powershell.git
synced 2025-01-11 07:19:24 -05:00
🎨 (Analyze dead links): Prettier output
Make a headline named 'Dead links found' and add each dead link on a new line
This commit is contained in:
parent
156114245b
commit
311845151a
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user