Skip to content

Instantly share code, notes, and snippets.

@pwc3
Last active May 18, 2022 17:30
Show Gist options
  • Save pwc3/839f88c32b7bdbd0e86b78d6d784e8bd to your computer and use it in GitHub Desktop.
Save pwc3/839f88c32b7bdbd0e86b78d6d784e8bd to your computer and use it in GitHub Desktop.
Downloads Github's recommended .gitignore for the specified language and prints it to stdout
#!/usr/bin/env bash
# Downloads Github's recommended .gitignore for the specified language and prints it to stdout.
#
# When starting a project:
# gh-gitignore Swift > .gitignore
set -euo pipefail
E_BADARGS=85
if [ $# -ne 1 ]; then
echo "Usage: $(basename $0) language" >&2
echo "Downloads Github's recommended .gitignore for the specified language" >&2
exit $E_BADARGS
fi
language="$1"
curl https://raw.githubusercontent.com/github/gitignore/main/${language}.gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment