From b3049daab56c90321616ba29867a8a18c74a6537 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 28 Dec 2023 06:30:26 +0000 Subject: [PATCH] feat: Add typos tool to check and correct typograp --- tools/typos | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tools/typos diff --git a/tools/typos b/tools/typos new file mode 100644 index 0000000..ddb39b2 --- /dev/null +++ b/tools/typos @@ -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