Add build-time option to change the color of the "OK" status text

This commit is contained in:
Alexander F Rødseth 2018-03-01 13:12:02 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 6d1d8f66e0
commit 96164a3936
3 changed files with 12 additions and 1 deletions

View File

@ -182,6 +182,9 @@ conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').to_upper())
conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))

View File

@ -298,6 +298,14 @@ option('slow-tests', type : 'boolean', value : 'false',
option('install-tests', type : 'boolean', value : 'false',
description : 'install test executables')
option('ok-color', type: 'combo',
choices : ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan',
'white', 'highlight_black', 'highlight_red', 'highlight_green',
'highlight_yellow', 'highlight_blue', 'highlight_magenta',
'highlight_cyan', 'highlight_white'],
value : 'green',
description: 'color of the "OK" status message')
option('oss-fuzz', type : 'boolean', value : 'false',
description : 'build against oss-fuzz')
option('llvm-fuzz', type : 'boolean', value : 'false',

View File

@ -696,7 +696,7 @@ _pure_ static const char *job_get_status_message_format(Unit *u, JobType t, JobR
static const struct {
const char *color, *word;
} job_print_status_messages [_JOB_RESULT_MAX] = {
[JOB_DONE] = { ANSI_GREEN, " OK " },
[JOB_DONE] = { ANSI_OK_COLOR, " OK " },
[JOB_TIMEOUT] = { ANSI_HIGHLIGHT_RED, " TIME " },
[JOB_FAILED] = { ANSI_HIGHLIGHT_RED, "FAILED" },
[JOB_DEPENDENCY] = { ANSI_HIGHLIGHT_YELLOW, "DEPEND" },