Last active
March 27, 2021 01:19
-
-
Save stes/2fd256e462dbb8fdb9ac7a947ba86217 to your computer and use it in GitHub Desktop.
Download .gitignore templates from https://github.com/github/gitignore
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 | |
# Download gitignore files from https://github.com/github/gitignore | |
# Example Usage: ./gitignore.sh Python Java > .gitignore | |
invalid_language() { | |
>&2 echo "No gitignore found for $1." | |
return 1 | |
} | |
echo_header() { | |
echo "## gitignore for ${1}" | |
echo "## Source: ${2}" | |
} | |
for language in $@; do | |
url="https://raw.githubusercontent.com/github/gitignore/master/${language}.gitignore" | |
wget -q --spider "$url" || invalid_language "${language}" || continue | |
echo_header "$language" "$url" | |
wget -q -O- "$url" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment