Skip to content

Commit

Permalink
feat: Add typos tool to check and correct typograp
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Dec 28, 2023
1 parent 94ec4d9 commit b3049da
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tools/typos
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Function to check for typos
check_typos() {
local dir=$1
grep -r -n "teh" $dir
grep -r -n "an d" $dir
grep -r -n "fro " $dir
}

# Function to correct typos
correct_typos() {
local file=$1
local typo=$2
local correct=$3
sed -i "s/$typo/$correct/g" $file
}

# Main function
main() {
local dir=$1
check_typos $dir
correct_typos $dir "teh" "the"
correct_typos $dir "an d" "and"
correct_typos $dir "fro " "for"
}

main $1

0 comments on commit b3049da

Please sign in to comment.