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

11 lines
294 B
Plaintext
Raw Normal View History

2024-09-22 19:14:22 +03:00
#!/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