[pacman-dev] [PATCH 12/15] colourize -Ss/-Qs
Simon Gomizelj
simongmzlj at gmail.com
Wed Mar 6 12:51:53 EST 2013
Signed-off-by: Simon Gomizelj <simongmzlj at gmail.com>
---
src/pacman/package.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 0213346..06d31d6 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -352,10 +352,12 @@ void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg)
alpm_pkg_t *lpkg = alpm_db_get_pkg(db_local, pkgname);
if(lpkg) {
const char *lpkgver = alpm_pkg_get_version(lpkg);
+ const colstr_t *colstr = &config->colstr;
if(strcmp(lpkgver, pkgver) == 0) {
- printf(" [%s]", _("installed"));
+ printf(" %s[%s]%s", colstr->meta, _("installed"), colstr->nocolor);
} else {
- printf(" [%s: %s]", _("installed"), lpkgver);
+ printf(" %s[%s: %s]%s", colstr->meta, _("installed"),
+ lpkgver, colstr->nocolor);
}
}
}
@@ -371,6 +373,7 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
int freelist = 0;
alpm_list_t *i, *searchlist;
unsigned short cols;
+ const colstr_t *colstr = &config->colstr;
/* if we have a targets list, search for packages matching it */
if(targets) {
@@ -392,12 +395,13 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
if(config->quiet) {
fputs(alpm_pkg_get_name(pkg), stdout);
} else {
- printf("%s/%s %s", alpm_db_get_name(db),
- alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
+ printf("%s%s/%s%s %s%s%s", colstr->repo, alpm_db_get_name(db),
+ colstr->title, alpm_pkg_get_name(pkg),
+ colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
alpm_list_t *k;
- fputs(" (", stdout);
+ printf(" %s(", colstr->groups);
for(k = grp; k; k = alpm_list_next(k)) {
const char *group = k->data;
fputs(group, stdout);
@@ -406,7 +410,7 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
putchar(' ');
}
}
- putchar(')');
+ printf(")%s", colstr->nocolor);
}
if(show_status) {
--
1.8.1.5
More information about the pacman-dev
mailing list