diff options
Diffstat (limited to 'src/pacman/sync.c')
-rw-r--r-- | src/pacman/sync.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 1b629429..4f11bb4c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -251,8 +251,19 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(j); - printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), - alpm_pkg_get_version(pkg)); + /* print the package size with the output if -z option passed */ + if(config->showsize) { + /* Convert byte size to MB */ + double mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); + + printf("%s/%s %s [%.2f MB]", alpm_db_get_name(db), + alpm_pkg_get_name(pkg), + alpm_pkg_get_version(pkg), mbsize); + } else { + printf("%s/%s %s", alpm_db_get_name(db), + alpm_pkg_get_name(pkg), + alpm_pkg_get_version(pkg)); + } if((grp = alpm_pkg_get_groups(pkg)) != NULL) { group = alpm_list_getdata(grp); |