Show group status during file search
When doing "pacman -Fs", show the "(groupname)" message just like "pacman -Ss". And refactor group printing to its own function. Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
2bec380e10
commit
961ef1a4c8
3 changed files with 22 additions and 15 deletions
|
@ -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->title, alpm_pkg_get_name(pkg),
|
||||||
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
||||||
|
|
||||||
|
print_groups(pkg);
|
||||||
print_installed(db_local, pkg);
|
print_installed(db_local, pkg);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|
|
@ -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.
|
* Display the details of a search.
|
||||||
* @param db the database we're searching
|
* @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();
|
cols = getcols();
|
||||||
for(i = searchlist; i; i = alpm_list_next(i)) {
|
for(i = searchlist; i; i = alpm_list_next(i)) {
|
||||||
alpm_list_t *grp;
|
|
||||||
alpm_pkg_t *pkg = i->data;
|
alpm_pkg_t *pkg = i->data;
|
||||||
|
|
||||||
if(config->quiet) {
|
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->title, alpm_pkg_get_name(pkg),
|
||||||
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
||||||
|
|
||||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
print_groups(pkg);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(show_status) {
|
if(show_status) {
|
||||||
print_installed(db_local, pkg);
|
print_installed(db_local, pkg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
|
||||||
void dump_pkg_changelog(alpm_pkg_t *pkg);
|
void dump_pkg_changelog(alpm_pkg_t *pkg);
|
||||||
|
|
||||||
void print_installed(alpm_db_t *db_local, 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);
|
int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status);
|
||||||
|
|
||||||
#endif /* PM_PACKAGE_H */
|
#endif /* PM_PACKAGE_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue