From 96164a3936af2dc2103d4d1ffa3b3b36b5017bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=20R=C3=B8dseth?= Date: Thu, 1 Mar 2018 13:12:02 +0100 Subject: [PATCH] Add build-time option to change the color of the "OK" status text --- meson.build | 3 +++ meson_options.txt | 8 ++++++++ src/core/job.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index def2351f21..5aa46cd579 100644 --- a/meson.build +++ b/meson.build @@ -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')) diff --git a/meson_options.txt b/meson_options.txt index dca9dfc16c..59fb20b0a4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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', diff --git a/src/core/job.c b/src/core/job.c index 249016f8b8..1b3534a7a6 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -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" },