zsh:glog: Only pipe to fzf if stdout is a tty

This makes it easy to use `glog` in a pipe as replacement for `git log
--oneline`, for example to count the commits.
This commit is contained in:
2022-12-27 04:25:56 +01:00
parent 46ec34826e
commit b93c4ee377

View File

@@ -127,7 +127,12 @@ else
)
fi
# Display the commits in the above format and pipe that into fzf.
git log "$formatshort" "$dateshort" --color=always "$@" \
| env LESS="$LESS${LESS:+ }-+F" fzf "${fzf_args[@]}"
# Display the commits in the above format and pipe that into fzf if stdout is a
# terminal.
if [ -t 1 ]; then
git log "$formatshort" "$dateshort" --color=always "$@" \
| env LESS="$LESS${LESS:+ }-+F" fzf "${fzf_args[@]}"
else
git log "$formatshort" "$dateshort" --color=always "$@"
fi
return 0