Skip to content

Instantly share code, notes, and snippets.

@fathergoose
Created February 17, 2023 21:26
Show Gist options
  • Save fathergoose/ad3bc0ed6019f43265ba5aeccc0b217f to your computer and use it in GitHub Desktop.
Save fathergoose/ad3bc0ed6019f43265ba5aeccc0b217f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ -f .gitignore ] && [ "$1" = "-a" ]; then
echo "File .gitignore already exists. Exiting."
exit 1
fi
if [ ! -d .git ]; then
echo "No .git directory found. Exiting."
exit 1
fi
if [ -n "$1" ]; then
curl -s "https://raw.githubusercontent.com/github/gitignore/main/$1.gitignore" >> .gitignore
exit 0
fi
SUBSET_LANGS="Go Java Node Python QT Rails Ruby Rust Scala"
PS3="Choose a language: "
select lang in $SUBSET_LANGS; do
curl -s "https://raw.githubusercontent.com/github/gitignore/main/$lang.gitignore" >> .gitignore
break
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment