[pacman-dev] [PATCH 01/11] load color into config
Daniel Wallace
daniel.wallace at gatech.edu
Sun Aug 5 05:46:37 EDT 2012
Tell pacman to print with colors
Signed-off-by: Daniel Wallace <daniel.wallace at gatech.edu>
---
src/pacman/conf.c | 3 +++
src/pacman/conf.h | 5 ++++-
src/pacman/pacman.c | 5 +++++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index f47b92d..3b3d3df 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -404,6 +404,9 @@ static int _parse_options(const char *key, char *value,
pm_printf(ALPM_LOG_DEBUG, "config: totaldownload\n");
} else if(strcmp(key, "CheckSpace") == 0) {
config->checkspace = 1;
+ } else if (strcmp(key, "Color") == 0) {
+ config->color = 1;
+ pm_printf(ALPM_LOG_DEBUG, "config: color\n");
} else {
pm_printf(ALPM_LOG_WARNING,
_("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"),
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 69c955e..3e17155 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -76,6 +76,8 @@ typedef struct __config_t {
/* conf file options */
/* I Love Candy! */
unsigned short chomp;
+ /* Add color */
+ unsigned short color;
/* format target pkg lists as table */
unsigned short verbosepkglists;
/* When downloading, display the amount downloaded, rate, ETA, and percent
@@ -127,7 +129,8 @@ enum {
OP_PRINTFORMAT,
OP_GPGDIR,
OP_DBONLY,
- OP_FORCE
+ OP_FORCE,
+ OP_COLOR
};
/* clean method */
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 73d5be9..732d7f3 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -196,6 +196,7 @@ static void usage(int op, const char * const myname)
addlist(_(" -v, --verbose be verbose\n"));
addlist(_(" --arch <arch> set an alternate architecture\n"));
addlist(_(" --cachedir <dir> set an alternate package cache location\n"));
+ addlist(_(" --color add color to output\n"));
addlist(_(" --config <path> set an alternate configuration file\n"));
addlist(_(" --debug display debug messages\n"));
addlist(_(" --gpgdir <path> set an alternate home directory for GnuPG\n"));
@@ -392,6 +393,9 @@ static int parsearg_global(int opt)
check_optarg();
config->cachedirs = alpm_list_add(config->cachedirs, strdup(optarg));
break;
+ case OP_COLOR:
+ config->color = 1;
+ break;
case OP_CONFIG:
check_optarg();
if(config->configfile) {
@@ -628,6 +632,7 @@ static int parseargs(int argc, char *argv[])
{"print-format", required_argument, 0, OP_PRINTFORMAT},
{"gpgdir", required_argument, 0, OP_GPGDIR},
{"dbonly", no_argument, 0, OP_DBONLY},
+ {"color", no_argument, 0, OP_COLOR},
{0, 0, 0, 0}
};
--
1.7.11.4
More information about the pacman-dev
mailing list