mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
parent
4d6bf04df2
commit
2d37bf1993
|
|
@ -131,9 +131,10 @@ export FORGIT_GI_INDEX=${FORGIT_GI_CACHE}/.index
|
||||||
__forgit_ignore() {
|
__forgit_ignore() {
|
||||||
[ -f $FORGIT_GI_INDEX ] || __forgit_ignore_update
|
[ -f $FORGIT_GI_INDEX ] || __forgit_ignore_update
|
||||||
local preview="echo {} |awk '{print \$2}' |xargs -I% bash -c 'cat $FORGIT_GI_CACHE/% 2>/dev/null || (curl -sL https://www.gitignore.io/api/% |tee $FORGIT_GI_CACHE/%)'"
|
local preview="echo {} |awk '{print \$2}' |xargs -I% bash -c 'cat $FORGIT_GI_CACHE/% 2>/dev/null || (curl -sL https://www.gitignore.io/api/% |tee $FORGIT_GI_CACHE/%)'"
|
||||||
OLDIFS=$IFS
|
${IFS+"false"} && unset oldifs || oldifs="$IFS" #store IFS
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
[[ $# -gt 0 ]] && args=($@) || args=($(cat $FORGIT_GI_INDEX |nl -nrn -w4 -s' ' |__forgit_fzf -m --preview="$preview" --preview-window="right:70%" |awk '{print $2}'))
|
[[ $# -gt 0 ]] && args=($@) || args=($(cat $FORGIT_GI_INDEX |nl -nrn -w4 -s' ' |__forgit_fzf -m --preview="$preview" --preview-window="right:70%" |awk '{print $2}'))
|
||||||
|
${oldifs+"false"} && unset IFS || IFS="$oldifs" # restore IFS
|
||||||
test -z "$args" && return 1
|
test -z "$args" && return 1
|
||||||
local options=(
|
local options=(
|
||||||
'(1) Output to stdout'
|
'(1) Output to stdout'
|
||||||
|
|
@ -151,7 +152,6 @@ __forgit_ignore() {
|
||||||
__forgit_ignore_get ${args[@]} > .gitignore
|
__forgit_ignore_get ${args[@]} > .gitignore
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
IFS=$OLDIFS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__forgit_ignore_update() {
|
__forgit_ignore_update() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue