Skip to content

Instantly share code, notes, and snippets.

@cristopher-rodrigues
Last active February 16, 2017 18:18
Show Gist options
  • Save cristopher-rodrigues/6eee63beb01d2c13636bc6b409206061 to your computer and use it in GitHub Desktop.
Save cristopher-rodrigues/6eee63beb01d2c13636bc6b409206061 to your computer and use it in GitHub Desktop.
gist todo
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
}
}
}'
@cristopher-rodrigues
Copy link
Author

export PROJECT_DIR=/Users/cristopher/Projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment