Any feedbacks on that patch ? Must I change something ? On Fri, Jan 24, 2014 at 5:22 PM, Guillaume Bouchard <guillaum.bouchard@gmail.com> wrote:
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 5450f3b..785061b 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 9faf5de..2edbe16 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 58b0cec..7cbbd33 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); + if(alpm_pkg_get_reason(target->remove ? target->remove : target->install) == ALPM_PKG_REASON_DEPEND) { + add_table_cell(&ret, str, CELL_DEPEND); + } else { + add_table_cell(&ret, str, CELL_NORMAL); + }
/* old and new versions */ pm_asprintf(&str, "%s", -- 1.8.5.2