Last active
February 16, 2017 18:18
-
-
Save cristopher-rodrigues/6eee63beb01d2c13636bc6b409206061 to your computer and use it in GitHub Desktop.
gist todo
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
PROJECT=$([ "$PROJECT" ] && echo "$PROJECT" || echo "Projects") | |
PROJECT_DIR=$([ "$PROJECT_DIR" ] && echo "$PROJECT_DIR" || echo "/var/www/") | |
PROJECT_PATH=$([ "$PROJECT_PATH" ] && echo "$PROJECT_PATH" || echo "glados") | |
TMP_FILE=/tmp/TODO | |
touch $TMP_FILE | |
files="$(find -L "$PROJECT_DIR/$PROJECT_PATH" -not -path "$PROJECT_DIR/$PROJECT_PATH/node_modules/*" -type f -name "*.js")" | |
echo "$files" | while read file; do | |
GIT_URL="https://github.com/ebanx/$PROJECT/blob/master/$(echo $file | grep -o $PROJECT_PATH'.*')" | |
grep -A0 -no 'TODO[^"]*' $file | | |
while read line; | |
do | |
LINE=$(echo "$line" | grep -o '^[0-9]*') | |
TODO=$(echo "$line" | grep -o 'TODO.*') | |
echo "- [ ] [$TODO]($GIT_URL$LINE)" >> $TMP_FILE; | |
done | |
done | |
# CREATE GITS / ISSUE | |
curl -XPOST 'https://api.github.com/gists' -d '{ | |
"description": "the description for this gist", | |
"public": true, | |
"files": { | |
"file1.txt": { | |
"content": $TMP_FILE | |
} | |
} | |
}' |
Author
cristopher-rodrigues
commented
Feb 16, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment