[pacman-dev] [PATCH 11/15] colourize the output if -Qi/Si

Simon Gomizelj simongmzlj at gmail.com
Wed Mar 6 12:51:52 EST 2013


Signed-off-by: Simon Gomizelj <simongmzlj at gmail.com>
---
 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 e94c295..0213346 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 8008c33..f44a661 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) {
-- 
1.8.1.5



More information about the pacman-dev mailing list