1
0
Fork 0

Add showebuild function

Show either installed, newest non-live or newest ebuild in less
This commit is contained in:
tastytea 2022-04-09 22:38:01 +02:00
parent 6ad16cd497
commit abf19647c7
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#compdef showebuild
autoload -U _gentoo_packages
_arguments '*:package:_gentoo_packages available'
# Local Variables:
# mode: shell-script
# End:

View File

@ -0,0 +1,20 @@
#!/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}