void-linux / xbps

The X Binary Package System (XBPS)
https://voidlinux.org/xbps/
Other
822 stars 124 forks source link

xbps-query: set a non-zero return code if requested property is not set for the queried package #498

Open RunningDroid opened 2 years ago

RunningDroid commented 2 years ago

Currently when I'm looking for a changelog and a package doesn't have the property set I fall back to opening the homepage, like this:

url=$(xbps-query --repository --property=changelog "$package")
if [[ -n $url ]]; then
    url=$(xbps-query --repository --property=homepage "$package")
fi
xdg-open "$url"

With this feature I could rewrite that to something like this:

if ! url=$(xbps-query --repository --property=changelog "$package"); then
    url=$(xbps-query --repository --property=homepage "$package")
fi
xdg-open "$url"