Skip to content

Instantly share code, notes, and snippets.

@saintmalik
Last active April 18, 2022 17:34
Show Gist options
  • Save saintmalik/b194aa4aba5bdaab8b74011fe9379ad3 to your computer and use it in GitHub Desktop.
Save saintmalik/b194aa4aba5bdaab8b74011fe9379ad3 to your computer and use it in GitHub Desktop.
#!/bin/bash
printf "Dont abuse and spam maintainers, ALWAYS MAKE QUALITY CONTRIBUTIONS!\n";
printf "Dont abuse and spam maintainers, ALWAYS MAKE QUALITY CONTRIBUTIONS!\n";
printf "Dont abuse and spam maintainers, ALWAYS MAKE QUALITY CONTRIBUTIONS!\n";
printf "Dont abuse and spam maintainers, ALWAYS MAKE QUALITY CONTRIBUTIONS!\n";
echo "$var"
#install Go
if [[ -z "$GOPATH" ]]; then
echo "It looks like go is not installed, would you like to install it now"
PS3="Please select an option : "
choices=("yes" "no")
select choice in "${choices[@]}"; do
case $choice in
yes)
echo "Installing Golang"
wget https://dl.google.com/go/go1.18.linux-amd64.tar.gz
sudo tar -xvf go1.18.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
echo 'export GOROOT=/usr/local/go' >> ~/.bash_profile
echo 'export GOPATH=$HOME/go' >> ~/.bash_profile
echo 'export PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> ~/.bash_profile
source ~/.bash_profile
sleep 1
printf "Golang has been installed....\n";
echo "$var"
break
;;
no)
echo "Please install go and rerun this script"
echo "Aborting installation..."
exit 1
;;
esac
done
fi
#install misspell
if ! [ -x "$(command -v misspell)" ]; then
echo "It looks like Misspell is not installed, would you like to install it now"
PS3="Please select an option : "
choices=("yes" "no")
select choice in "${choices[@]}"; do
case $choice in
yes)
echo "Installing Misspell"
go install github.com/client9/misspell/cmd/misspell@latest
sleep 1
printf "Misspeell installed....\n";
echo "$var"
break
;;
no)
echo "Please install Misspell and rerun this script"
echo "Aborting installation..."
exit 1
;;
esac
done
fi
#check git
if ! [ -x "$(command -v git)" ]; then
echo "It looks like git is not installed, would you like to install it now"
PS3="Please select an option : "
choices=("yes" "no")
select choice in "${choices[@]}"; do
case $choice in
yes)
echo "Installing git"
sudo apt-get install git
sleep 1
printf "Git has been installed....\n";
echo "$var"
break
;;
no)
echo "Please install git and rerun this script"
echo "Aborting installation..."
exit 1
;;
esac
done
fi
touch $1
while IFS= read -r line; do
echo "Git Cloning $line"
git clone $line
echo "------------------------------------------------------"
done < urls.txt
while IFS= read -r line; do
echo "$line" | cut -d/ -f5- >> repo.txt
done < urls.txt
while IFS= read -r line; do
echo $line -type f -name "*.md" -o -name "*.mdx" -o -name "*.yml" -o -name "*.html" -o -name "*.yaml" -o -name "*.go" | xargs misspell -error >> ./$1 2>&1
done < repo.txt
echo "$var"
printf "All done, now you can check $1 for typos..\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment