From c47fb9bd148f0dfdeeea0d21a7647dbab44c709b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sun, 29 Oct 2023 23:07:37 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(git):=20added=20script=20for?= =?UTF-8?q?=20easy=20gitignore=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitconfig | 3 ++- .local/bin/gitignore | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 .local/bin/gitignore diff --git a/.gitconfig b/.gitconfig index 2308077d..ca0ed678 100644 --- a/.gitconfig +++ b/.gitconfig @@ -233,4 +233,5 @@ ours = "!f() { git checkout --ours $@ && git add $@; }; f" theirs = "!f() { git checkout --theirs $@ && git add $@; }; f" 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" diff --git a/.local/bin/gitignore b/.local/bin/gitignore new file mode 100755 index 00000000..6fd361ca --- /dev/null +++ b/.local/bin/gitignore @@ -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 +