diff options
author | Simon Gomizelj <simongmzlj@gmail.com> | 2013-03-01 20:27:40 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-03-07 06:55:04 +0100 |
commit | c8c7a5137473770eb4b2d9d54495c2a39b32cbe3 (patch) | |
tree | 4582021cba970256c6fa4efeb0fe9e557e8a89ae /src/pacman/conf.c | |
parent | ea42d03ea153a17edc792844c572f0d3d0803bd6 (diff) | |
download | pacman-c8c7a5137473770eb4b2d9d54495c2a39b32cbe3.tar.gz pacman-c8c7a5137473770eb4b2d9d54495c2a39b32cbe3.tar.xz |
add a config settings and flag for colours
Colours can be enabled in two ways:
- Add Color to pacman.conf. This enables colours automatically.
- Use --color=WHEN where WHEN is none/auto/always.
WHEN as 'never' disables colours (overrides config file), as 'auto'
enables colours when stdout is a tty, and 'always' enables colours no
matter what.
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/conf.c')
-rw-r--r-- | src/pacman/conf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 218ffb46..dca6e3e1 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -436,6 +436,10 @@ 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) { + if(config->color == PM_COLOR_UNSET) { + config->color = isatty(fileno(stdout)) ? PM_COLOR_ON : PM_COLOR_OFF; + } } else { pm_printf(ALPM_LOG_WARNING, _("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"), |