summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pacman/files.c1
-rw-r--r--src/pacman/package.c35
-rw-r--r--src/pacman/package.h1
3 files changed, 22 insertions, 15 deletions
diff --git a/src/pacman/files.c b/src/pacman/files.c
index 58cf8d3d..fa4170bd 100644
--- a/src/pacman/files.c
+++ b/src/pacman/files.c
@@ -162,6 +162,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
colstr->title, alpm_pkg_get_name(pkg),
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
+ print_groups(pkg);
print_installed(db_local, pkg);
printf("\n");
diff --git a/src/pacman/package.c b/src/pacman/package.c
index ee43dca7..d8880837 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -494,6 +494,25 @@ void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg)
}
}
+void print_groups(alpm_pkg_t *pkg)
+{
+ alpm_list_t *grp;
+ if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
+ const colstr_t *colstr = &config->colstr;
+ alpm_list_t *k;
+ printf(" %s(", colstr->groups);
+ for(k = grp; k; k = alpm_list_next(k)) {
+ const char *group = k->data;
+ fputs(group, stdout);
+ if(alpm_list_next(k)) {
+ /* only print a spacer if there are more groups */
+ putchar(' ');
+ }
+ }
+ printf(")%s", colstr->nocolor);
+ }
+}
+
/**
* Display the details of a search.
* @param db the database we're searching
@@ -526,7 +545,6 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
cols = getcols();
for(i = searchlist; i; i = alpm_list_next(i)) {
- alpm_list_t *grp;
alpm_pkg_t *pkg = i->data;
if(config->quiet) {
@@ -536,20 +554,7 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
colstr->title, alpm_pkg_get_name(pkg),
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
- if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
- alpm_list_t *k;
- printf(" %s(", colstr->groups);
- for(k = grp; k; k = alpm_list_next(k)) {
- const char *group = k->data;
- fputs(group, stdout);
- if(alpm_list_next(k)) {
- /* only print a spacer if there are more groups */
- putchar(' ');
- }
- }
- printf(")%s", colstr->nocolor);
- }
-
+ print_groups(pkg);
if(show_status) {
print_installed(db_local, pkg);
}
diff --git a/src/pacman/package.h b/src/pacman/package.h
index 68c2a630..03e1afa0 100644
--- a/src/pacman/package.h
+++ b/src/pacman/package.h
@@ -29,6 +29,7 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
void dump_pkg_changelog(alpm_pkg_t *pkg);
void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg);
+void print_groups(alpm_pkg_t *pkg);
int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status);
#endif /* PM_PACKAGE_H */