1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 08:18:51 -05:00

Enable display of multiple groups in -Ss and -Qs output

Not too complicated of a fix, but just adds some code to loop over the
entire group list and space it out.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-03-30 16:41:13 -05:00
parent 4b8ada818e
commit 5f17ac8150
2 changed files with 22 additions and 6 deletions

View File

@ -175,9 +175,17 @@ static int query_search(alpm_list_t *targets)
if (!config->quiet) { if (!config->quiet) {
if((grp = alpm_pkg_get_groups(pkg)) != NULL) { if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
/* TODO handle multiple groups */ alpm_list_t *k;
const char *group = alpm_list_getdata(grp); printf(" (");
printf(" (%s)", group); for(k = grp; k; k = alpm_list_next(k)) {
const char *group = alpm_list_getdata(k);
printf("%s", group);
if(alpm_list_next(k)) {
/* only print a spacer if there are more groups */
printf(" ");
}
}
printf(")");
} }
/* we need a newline and initial indent first */ /* we need a newline and initial indent first */

View File

@ -351,10 +351,18 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
} }
if (!config->quiet) { if (!config->quiet) {
/* TODO package in multiple groups needs to be handled, do a loop */
if((grp = alpm_pkg_get_groups(pkg)) != NULL) { if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
const char *group = alpm_list_getdata(grp); alpm_list_t *k;
printf(" (%s)", group); printf(" (");
for(k = grp; k; k = alpm_list_next(k)) {
const char *group = alpm_list_getdata(k);
printf("%s", group);
if(alpm_list_next(k)) {
/* only print a spacer if there are more groups */
printf(" ");
}
}
printf(")");
} }
/* we need a newline and initial indent first */ /* we need a newline and initial indent first */