feat(git): added script for easy gitignore creation

This commit is contained in:
Sergio Laín 2023-10-29 23:07:37 +01:00
parent eea1e69238
commit c47fb9bd14
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 15 additions and 1 deletions

View file

@ -234,3 +234,4 @@
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f" theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
subrepo = !sh -c 'git filter-branch --prune-empty --subdirectory-filter $1 master' - subrepo = !sh -c 'git filter-branch --prune-empty --subdirectory-filter $1 master' -
human = name-rev --name-only --refs=refs/heads/* human = name-rev --name-only --refs=refs/heads/*
ig = "!f() { gitignore \"$@\"; }; f"

13
.local/bin/gitignore Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
function __gi() {
curl -L -s https://www.gitignore.io/api/"$@"
}
IFS=","
selected_profiles=$(for item in $(__gi list); do echo $item; done | fzf --multi --ansi | paste -s -d "," -)
if [ -n "$selected_profiles" ]; then
echo "$selected_profiles" | { read result && __gi "$result" > .gitignore; echo "Created .gitignore"; }
fi