In extended table view, packages which are not explicitly installed are displayed in grey. This helps understanding why packages are updated. This helps the package managment workflow. During update, we can quickly have a look at why packages are updated and easilly track and remove the explicit packages which are not longer required. During remove, it shows all the explicit packages which are also removed by a cascade removal. During install, it provides a feedback on how your action will affect the database. This patch created a new colstr setting and associate it with BOLDBLACK (i.e. grey). Signed-off-by: Guillaume Bouchard <guillaum.bouchard@gmail.com> --- src/pacman/conf.c | 1 + src/pacman/conf.h | 1 + src/pacman/util.c | 13 ++++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 4b7ec05..243203f 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -76,6 +76,7 @@ void enable_colors(int colors) colstr->warn = BOLDYELLOW; colstr->err = BOLDRED; colstr->nocolor = NOCOLOR; + colstr->depend = BOLDBLACK; } } diff --git a/src/pacman/conf.h b/src/pacman/conf.h index e8cac50..4af5eeb 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -32,6 +32,7 @@ typedef struct __colstr_t { const char *warn; const char *err; const char *nocolor; + const char *depend; } colstr_t; typedef struct __config_t { diff --git a/src/pacman/util.c b/src/pacman/util.c index cbe371d..699d347 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -57,7 +57,8 @@ enum { CELL_NORMAL = 0, CELL_TITLE = (1 << 0), CELL_RIGHT_ALIGN = (1 << 1), - CELL_FREE = (1 << 3) + CELL_FREE = (1 << 3), + CELL_DEPEND = (1 << 4) }; int trans_init(alpm_transflag_t flags, int check_valid) @@ -488,7 +489,9 @@ static void table_print_line(const alpm_list_t *line, short col_padding, if(cell->mode & CELL_TITLE) { printf("%s%*s%s", config->colstr.title, cell_width, str, config->colstr.nocolor); - } else { + } else if(cell->mode & CELL_DEPEND) { + printf("%s%*s%s", config->colstr.depend, cell_width, str, config->colstr.nocolor); + } else { printf("%*s", cell_width, str); } need_padding = 1; @@ -808,7 +811,11 @@ static alpm_list_t *create_verbose_row(pm_target_t *target) } else { pm_asprintf(&str, "%s", alpm_pkg_get_name(target->remove)); } - add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); + if(alpm_pkg_get_reason(target->remove ? target->remove : target->install) == ALPM_PKG_REASON_DEPEND) { + add_table_cell(&ret, str, CELL_DEPEND | CELL_FREE); + } else { + add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE); + } /* old and new versions */ pm_asprintf(&str, "%s", -- 1.8.5.3