Last active
March 22, 2024 22:38
-
-
Save keithhackbarth/e6cd70dafdd2ead1b6a91c5a623d6ab8 to your computer and use it in GitHub Desktop.
Check Todos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Step 1: Store the modified output in a variable | |
todos=$(git grep -l TODO ./src | grep -v 'graphqlTypes' | xargs -n1 git blame -f -w | grep TODO | sed 's/\([0-9]\{2,\}\)) */\1) /') | |
# Step 2: Count the number of lines in the modified output | |
todo_count=$(echo "$todos" | grep -v '^$' | wc -l | sed 's/^[[:space:]]*//') # Remove leading spaces | |
# Step 3: Print the count in yellow text | |
if [ "$todo_count" -gt 0 ]; then | |
echo -e "\033[1;33mWARNING: $todo_count TODO$([ "$todo_count" -gt 1 ] && echo 's') remaining\033[0m" | |
echo "$todos" | |
echo "" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment