colourize the output of -Qi/Si

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Simon Gomizelj 2013-03-01 15:18:28 -05:00 committed by Allan McRae
parent ce06e6f9b9
commit 46c10c5bf3
2 changed files with 11 additions and 7 deletions

View File

@ -167,13 +167,16 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
size = humanize_size(alpm_pkg_get_size(pkg), 'K', 2, &label);
if(from == ALPM_PKG_FROM_SYNCDB) {
printf(_("Download Size : %6.2f %s\n"), size, label);
printf("%s%s%s %6.2f %s\n", config->colstr.title, _("Download Size :"),
config->colstr.nocolor, size, label);
} else if(from == ALPM_PKG_FROM_FILE) {
printf(_("Compressed Size: %6.2f %s\n"), size, label);
printf("%s%s%s %6.2f %s\n", config->colstr.title, _("Compressed Size:"),
config->colstr.nocolor, size, label);
}
size = humanize_size(alpm_pkg_get_isize(pkg), 'K', 2, &label);
printf(_("Installed Size : %6.2f %s\n"), size, label);
printf("%s%s%s %6.2f %s\n", config->colstr.title, _("Installed Size :"),
config->colstr.nocolor, size, label);
string_display(_("Packager :"), alpm_pkg_get_packager(pkg), cols);
string_display(_("Build Date :"), bdatestr, cols);
@ -267,7 +270,8 @@ void dump_pkg_backups(alpm_pkg_t *pkg)
{
alpm_list_t *i;
const char *root = alpm_option_get_root(config->handle);
printf(_("Backup Files:\n"));
printf("%s%s%s", config->colstr.title, _("Backup Files:\n"),
config->colstr.nocolor);
if(alpm_pkg_get_backup(pkg)) {
/* package has backup files, so print them */
for(i = alpm_pkg_get_backup(pkg); i; i = alpm_list_next(i)) {

View File

@ -427,7 +427,7 @@ static size_t string_length(const char *s)
void string_display(const char *title, const char *string, unsigned short cols)
{
if(title) {
printf("%s ", title);
printf("%s%s%s ", config->colstr.title, title, config->colstr.nocolor);
}
if(string == NULL || string[0] == '\0') {
printf(_("None"));
@ -620,7 +620,7 @@ void list_display(const char *title, const alpm_list_t *list,
if(title) {
len = string_length(title) + 1;
printf("%s ", title);
printf("%s%s%s ", config->colstr.title, title, config->colstr.nocolor);
}
if(!list) {
@ -660,7 +660,7 @@ void list_display_linebreak(const char *title, const alpm_list_t *list,
if(title) {
len = (unsigned short)string_length(title) + 1;
printf("%s ", title);
printf("%s%s%s ", config->colstr.title, title, config->colstr.nocolor);
}
if(!list) {