Skip to content

Instantly share code, notes, and snippets.

@saxbophone
Created November 17, 2022 16:26
Show Gist options
  • Save saxbophone/845524793b98093d085c9179d8a99eb1 to your computer and use it in GitHub Desktop.
Save saxbophone/845524793b98093d085c9179d8a99eb1 to your computer and use it in GitHub Desktop.
Generate .gitignore files for given languages straight from the comfort of the UNIX shell
# Created by Joshua Saxby 2022
# This BASH shell script function is placed into the Public Domain
# There are no restrictions on its use but it is provided with ABSOLUTELY no liability, warranty, etc, etc...
# !!don't sue me for using it at your own risk...!!
# uses the new version of the former gitignore.io API to generate gitignore files for given languages
# usage: $ gitignore <lang 1> <lang 2> ... <lang n>
#
# NOTE: overwrites local .gitignore file in-place
function gitignore() {
local lang_list=$(echo "$*" | tr " " ,);
wget "https://www.toptal.com/developers/gitignore/api/$lang_list" -O .gitignore;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment