mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 21:38:19 -05:00
select_display: per-database output
This function is used both for provision and group selection. Now the database name will be displayed. $ pacman -S base-devel :: There are 11 members in group base-devel: :: Repository testing 1) make :: Repository core 2) autoconf 3) automake 4) bison 5) fakeroot 6) flex 7) gcc 8) libtool 9) m4 10) patch 11) pkg-config Which ones do you want to install? Enter a number (default=all): Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
This commit is contained in:
parent
2dd53e50de
commit
05f2abfba9
@ -677,20 +677,40 @@ void display_optdepends(pmpkg_t *pkg)
|
||||
}
|
||||
}
|
||||
|
||||
static void display_repo_list(const char *dbname, alpm_list_t *list)
|
||||
{
|
||||
const char *prefix= " ";
|
||||
|
||||
printf(":: ");
|
||||
printf(_("Repository %s\n"), dbname);
|
||||
list_display(prefix, list);
|
||||
}
|
||||
|
||||
void select_display(const alpm_list_t *pkglist)
|
||||
{
|
||||
const alpm_list_t *i;
|
||||
int nth = 1;
|
||||
alpm_list_t *list = NULL;
|
||||
char *string = NULL;
|
||||
const char *dbname = NULL;
|
||||
|
||||
for (i = pkglist; i; i = i->next) {
|
||||
pmpkg_t *pkg = alpm_list_getdata(i);
|
||||
pmdb_t *db = alpm_pkg_get_db(pkg);
|
||||
|
||||
if(!dbname)
|
||||
dbname = alpm_db_get_name(db);
|
||||
if(strcmp(alpm_db_get_name(db), dbname) != 0) {
|
||||
display_repo_list(dbname, list);
|
||||
FREELIST(list);
|
||||
dbname = alpm_db_get_name(db);
|
||||
}
|
||||
string = NULL;
|
||||
pm_asprintf(&string, "%d) %s", nth, alpm_pkg_get_name(i->data));
|
||||
pm_asprintf(&string, "%d) %s", nth, alpm_pkg_get_name(pkg));
|
||||
list = alpm_list_add(list, string);
|
||||
nth++;
|
||||
}
|
||||
list_display(" ", list);
|
||||
display_repo_list(dbname, list);
|
||||
FREELIST(list);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user