bin: add git-ignore
This commit is contained in:
parent
71c07b1998
commit
c0dea465da
1 changed files with 26 additions and 0 deletions
26
bin/git-ignore
Executable file
26
bin/git-ignore
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
WORKDIR="${XDG_CACHE_HOME:-$HOME/.cache}/git-ignore"
|
||||
URL="https://github.com/github/gitignore.git"
|
||||
|
||||
if [ ! -d "$WORKDIR" ]; then
|
||||
git clone --quiet --depth 1 "$URL" "$WORKDIR"
|
||||
else
|
||||
git -C "$WORKDIR" pull --quiet
|
||||
fi
|
||||
|
||||
find "$WORKDIR" -maxdepth 1 -type f -name '*gitignore' |
|
||||
sed -e "s,^$WORKDIR/\(.*\)\.gitignore$,\1," |
|
||||
sort |
|
||||
fzf --multi \
|
||||
--preview="cat $WORKDIR/{}.gitignore" \
|
||||
--bind='ctrl-p:toggle-preview' |
|
||||
while read -r lang; do
|
||||
echo "############################################################"
|
||||
echo "# ${lang}"
|
||||
echo "############################################################"
|
||||
cat "$WORKDIR/${lang}.gitignore"
|
||||
echo
|
||||
done
|
Loading…
Add table
Reference in a new issue