Skip to content

Commit

Permalink
Refactor: Remove REPL prompts (>>>) from documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyan-max committed Feb 8, 2025
1 parent 1fb2b22 commit 92a21f5
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions replace-text.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Define the directories to search
$directories = @("docs/guides", "docs/migration-guides")

# Define the search pattern and replacement text
$searchPattern = ">>> "
$replacementText = "print("
# Define the search pattern and replacement format
$searchPattern = ">>> (.+)"
$replacementText = "print(`$1)"

# Loop through each directory and process the files
foreach ($directory in $directories) {
Get-ChildItem -Path $directory -Recurse -File | ForEach-Object {
(Get-Content -Path $_.FullName) -replace [regex]::Escape($searchPattern), $replacementText | Set-Content -Path $_.FullName
# Read file content
$content = Get-Content -Path $_.FullName

# Replace occurrences of >>> with print()
$newContent = $content -replace $searchPattern, $replacementText

# Write back the modified content
$newContent | Set-Content -Path $_.FullName
}
}
}

0 comments on commit 92a21f5

Please sign in to comment.