Last active
August 29, 2015 14:05
-
-
Save matiassingers/8248b4345fb56b8a08da to your computer and use it in GitHub Desktop.
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
# .gitignore function | |
# Improved a little upon the original by kqr - https://github.com/kqr/gists/blob/51f63900924e483888cdd7f777177e804bfb0cca/utils/gi | |
function gi() { | |
result=$(curl "http://www.gitignore.io/api/$1" 2>/dev/null) | |
if [[ $result =~ ERROR ]]; then | |
echo "Query '$1' has no match. See a list of possible queries with 'gi list'" | |
elif [[ $1 = list ]]; then | |
echo "$result" | |
else | |
if [[ -f .gitignore ]]; then | |
result=`echo "$result" | grep -v "# Created by http://www.gitignore.io"` | |
echo ".gitignore already exists, appending" | |
echo "$result" >> .gitignore | |
else | |
echo "$result" > .gitignore | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment