Skip to content

Instantly share code, notes, and snippets.

@phha
Created August 10, 2017 17:30
Show Gist options
  • Save phha/cb4f4bb07519dc494609792fb918e167 to your computer and use it in GitHub Desktop.
Save phha/cb4f4bb07519dc494609792fb918e167 to your computer and use it in GitHub Desktop.
Interactively greate a gitignore file from gitignore.io
#!/bin/sh
# Create useful gitignore files
# Usage: gi [param]
# param is a comma separated list of ignore profiles.
# If param is ommited choose interactively.
function __gi() {
curl -L -s https://www.gitignore.io/api/"$@"
}
if [ "$#" -eq 0 ]; then
IFS+=","
for item in $(__gi list); do
echo $item
done | fzf --multi --ansi | paste -s -d "," - |
{ read result && __gi "$result"; }
else
__gi "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment