Skip to content

Commit f9a8b39

Browse files
committed
xbps-query: add message when no packages have been found
1 parent 061f5cb commit f9a8b39

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bin/xbps-query/search.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
5858
const char *pkgver = NULL, *desc = NULL;
5959
unsigned int align = 0, len;
6060

61+
if (!xbps_array_count(sd->results)) {
62+
fprintf(stderr, "No packages have been found with query %s.\n", sd->pat);
63+
return;
64+
}
65+
6166
/* Iterate over results array and find out largest pkgver string */
6267
for (unsigned int i = 0; i < xbps_array_count(sd->results); i += 2) {
6368
xbps_array_get_cstring_nocopy(sd->results, i, &pkgver);
@@ -259,7 +264,7 @@ search(struct xbps_handle *xhp, bool repo_mode, const char *pat, const char *pro
259264
return rv;
260265
}
261266
}
262-
if (!prop && xbps_array_count(sd.results)) {
267+
if (!prop) {
263268
print_results(xhp, &sd);
264269
xbps_object_release(sd.results);
265270
}

0 commit comments

Comments
 (0)