Last active
March 15, 2017 16:55
-
-
Save zessx/eeeac15ab0801c50fa3158af9b97adde to your computer and use it in GitHub Desktop.
Search for single line TODOs in your project
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 | |
# Usage: | |
# ./todo.sh | |
# ./todo.sh folder1 folder2/subfolder | |
FOLDERS='./' | |
if [[ $* ]]; then | |
FOLDERS=$* | |
fi | |
RED='\033[1;31m' | |
GREEN='\033[1;32m' | |
NC='\033[0m' | |
SED_BLUE=`echo -e '\033[0;34m'` | |
SED_GREEN=`echo -e '\033[1;32m'` | |
SED_NC=`echo -e '\033[0m'` | |
GREP_PARAMS="-s -r -i --exclude todo.sh --exclude-dir node_modules --exclude-dir vendor todo ${FOLDERS}" | |
if [[ $(grep ${GREP_PARAMS}) ]]; then | |
echo -e "${RED}TODO list:${NC}" | |
grep -n ${GREP_PARAMS} | sed -r "s/(.+):(.+):.*todo\s*:?\s*(.*)/$SED_BLUE\1 $SED_GREEN\(line \2\) $SED_NC\3/I" | sed 's/#}//' | sed 's/*\///' | |
else | |
echo -e "${GREEN}TODO list empty.${NC}" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment