diff options
author | Nathan Jones <nathanj@insightbb.com> | 2007-05-14 01:21:42 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-05-14 01:22:15 -0400 |
commit | 5c930c318e7b80af3a322ddc7ddf9fe100e9c16b (patch) | |
tree | f0a5480fe7d324f8c66041ed36699c9168259f58 /src/pacman/query.c | |
parent | 14c768365cc32659d0adf0887f93c39d340089fc (diff) |
Display size for packages
This patch adds a -z|--showsize option to the -Q and -S commands. The
option displays the size of individual packages. This is something that
I have wanted for a while, and there is a feature request for it.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/query.c')
-rw-r--r-- | src/pacman/query.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c index dcb7c6bb..bb4cfb9d 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -146,7 +146,17 @@ int pacman_query(alpm_list_t *targets) alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(i); - printf("local/%s %s", 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("local/%s %s [%.2f MB]", alpm_pkg_get_name(pkg), + alpm_pkg_get_version(pkg), mbsize); + } else { + printf("local/%s %s", alpm_pkg_get_name(pkg), + alpm_pkg_get_version(pkg)); + } if((grp = alpm_pkg_get_groups(pkg)) != NULL) { group = alpm_list_getdata(grp); |