dotfiles/.config/zsh/functions/showebuild
tastytea abf19647c7
Add showebuild function
Show either installed, newest non-live or newest ebuild in less
2022-04-09 22:38:01 +02:00

21 lines
500 B
Bash
Executable File

#!/usr/bin/env zsh
# Show either installed, newest non-live or newest ebuild
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
autoload -U die
[[ ${ARGC} -eq 0 ]] && die 1 "Usage: ${0} <PKG>"
local pkg=${1}
local ebuild=$(qwhich --vdb --latest ${pkg})
if [[ -z ${ebuild} ]]; then
for ebuild in $(qwhich --tree ${pkg} | sort --numeric-sort --reverse); do
[[ ${ebuild} =~ '9999(-r\d+)?\.ebuild$' ]] || break
done
fi
[[ -z ${ebuild} ]] && die 1 "Package not found"
less ${ebuild}