Add build-time option to change the color of the "OK" status text
authorAlexander F Rødseth <alexander.rodseth@appeartv.com>
Thu, 1 Mar 2018 12:12:02 +0000 (13:12 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 2 Mar 2018 08:00:44 +0000 (09:00 +0100)
meson.build
meson_options.txt
src/core/job.c

index def2351..5aa46cd 100644 (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'))
index dca9dfc..59fb20b 100644 (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',
index 249016f..1b3534a 100644 (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" },