global/git: exit from fzf scripts outside git repository

This commit is contained in:
Infinidoge 2024-06-16 15:00:30 -04:00
parent 1f37135b7b
commit cf1eaf4c12
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -7,6 +7,7 @@
git ls-files &> /dev/null
if [[ $? -eq 128 ]] then
echo "Not in a git repository"
exit 1
elif [[ $# -eq 0 ]] then
echo "$(git ls-files | fzf)"
else
@ -17,6 +18,7 @@
git ls-files &> /dev/null
if [[ $? -eq 128 ]] then
echo "Not in a git repository"
exit 1
elif [[ $# -eq 0 ]] then
$EDITOR "$(git ls-files | fzf)"
else