Skip to content

Commit

Permalink
chore(scripts): add check-guid-valid.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
abgox committed Aug 14, 2024
1 parent 06f06db commit a5e8c05
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/check-guid-valid.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$invalideGuid = @()
Get-ChildItem -Path "$PSScriptRoot\..\completions\" -Directory | ForEach-Object {
# $url = "https://raw.githubusercontent.com/abgox/PSCompletions/main/completions/$($_.Name)/guid.txt"
$url = "https://gitee.com/abgox/PSCompletions/raw/main/completions/$($_.Name)/guid.txt"
try {
$content = Invoke-WebRequest -Uri $url
$content = $content.Content.Trim()
$content
if (!($content -match "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$")) {
$invalideGuid += $_.Name
}
}
catch {}
}
if ($invalideGuid) {
write-host "------------------------------------" -ForegroundColor Yellow
Write-Host "The following guid.txt are invalid:" -ForegroundColor Yellow
foreach ($item in $invalideGuid) {
Write-Host $item -ForegroundColor Red
}
}
else {
write-host "------------------------------------" -ForegroundColor Green
Write-Host "All guid.txt are valid." -ForegroundColor Green
}

0 comments on commit a5e8c05

Please sign in to comment.