Skip to content

Commit

Permalink
xbps-query: add message when no packages have been found
Browse files Browse the repository at this point in the history
  • Loading branch information
OfekShochat committed Jul 30, 2022
1 parent 061f5cb commit 58234b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/xbps-query/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
const char *pkgver = NULL, *desc = NULL;
unsigned int align = 0, len;

if (xhp->flags & XBPS_FLAG_VERBOSE && !xbps_array_count(sd->results)) {
printf("No packages have been found with query %s.", sd->pat);
return;
}

/* Iterate over results array and find out largest pkgver string */
for (unsigned int i = 0; i < xbps_array_count(sd->results); i += 2) {
xbps_array_get_cstring_nocopy(sd->results, i, &pkgver);
Expand Down Expand Up @@ -259,7 +264,7 @@ search(struct xbps_handle *xhp, bool repo_mode, const char *pat, const char *pro
return rv;
}
}
if (!prop && xbps_array_count(sd.results)) {
if (!prop) {
print_results(xhp, &sd);
xbps_object_release(sd.results);
}
Expand Down

0 comments on commit 58234b7

Please sign in to comment.