-
Notifications
You must be signed in to change notification settings - Fork 304
/
correct-permissions-reference-errors.ps1
39 lines (32 loc) · 1.28 KB
/
correct-permissions-reference-errors.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$docsRepoPath = Join-Path (Get-Location).Path -ChildPath "docs"
$permissionsReferenceFilePath = Join-Path $docsRepoPath -ChildPath "\concepts\permissions-reference.md"
# Define a hash table of typos and their corrections
$corrections = @{
"Precention" = "Prevention"
"oganization's" = "organization's"
"backed up snapshot" = "backed-up snapshot"
"organizatio" = "organization"
"organization\u2019s" = "organization's"
"device\u2019s" = "device's"
"providers\u2019" = "providers'"
"the the signed-in user" = "the signed-in user"
"dimissing" = "dismissing"
"user\u2019s" = "user's"
"users\u2019" = "users'"
"intellgence" = "intelligence"
"polices" = "policies"
"by the you" = "by you"
"mesages" = "messages"
"team\u2019s" = "team's"
"calendars\u0020." = "calendars."
}
# Read the file content
$content = Get-Content -Path $permissionsReferenceFilePath -Raw
# Iterate through the corrections and replace typos
foreach ($typo in $corrections.Keys) {
$content = $content -replace "\b$typo\b", $corrections[$typo]
}
$content = $content -replace "’", "'"
# Write the corrected content back to the file
Set-Content -Path $permissionsReferenceFilePath -Value $content
Write-Output "Typos corrected and saved in $permissionsReferenceFilePath."