dotfiles/.zsh/zsh-fzf-tab/lib/-ftb-version

11 lines
294 B
Bash

#!/hint/zsh
emulate -L zsh -o pipe_fail
pushd -q $FZF_TAB_HOME
if [[ -d .git ]]; then
git describe --long --tags --abbrev=7 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' \
|| printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
else
echo unknown
fi
popd -q