xbps icon indicating copy to clipboard operation
xbps copied to clipboard

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

Open RunningDroid opened this issue 2 years ago • 0 comments

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" 

RunningDroid avatar Jul 17 '22 23:07 RunningDroid