From 46c10c5bf32d00a30a452be4a966983e1a0905da Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Fri, 1 Mar 2013 15:18:28 -0500 Subject: colourize the output of -Qi/Si Signed-off-by: Simon Gomizelj Signed-off-by: Allan McRae --- src/pacman/package.c | 12 ++++++++---- src/pacman/util.c | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pacman/package.c b/src/pacman/package.c index b1ba0155..d347697c 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -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)) { diff --git a/src/pacman/util.c b/src/pacman/util.c index f58013a9..57968a49 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -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) { -- cgit v1.2.3-24-g4f1b