mirror of
https://github.com/systemd/systemd
synced 2024-10-15 04:24:19 +00:00
Merge pull request #8323 from xyproto/ok_color
Make the color of the status OK configurable at build-time
This commit is contained in:
commit
3cca71c456
|
@ -195,6 +195,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').underscorify().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'))
|
||||
|
|
|
@ -300,6 +300,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',
|
||||
|
|
|
@ -28,21 +28,45 @@
|
|||
#include "macro.h"
|
||||
#include "time-util.h"
|
||||
|
||||
/* Regular colors */
|
||||
#define ANSI_BLACK "\x1B[0;30m"
|
||||
#define ANSI_RED "\x1B[0;31m"
|
||||
#define ANSI_GREEN "\x1B[0;32m"
|
||||
#define ANSI_UNDERLINE "\x1B[0;4m"
|
||||
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
|
||||
#define ANSI_YELLOW "\x1B[0;33m"
|
||||
#define ANSI_BLUE "\x1B[0;34m"
|
||||
#define ANSI_MAGENTA "\x1B[0;35m"
|
||||
#define ANSI_CYAN "\x1B[0;36m"
|
||||
#define ANSI_WHITE "\x1B[0;37m"
|
||||
|
||||
/* Bold/highlighted */
|
||||
#define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m"
|
||||
#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
|
||||
#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
|
||||
#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m"
|
||||
#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
|
||||
#define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
|
||||
#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m"
|
||||
#define ANSI_HIGHLIGHT_CYAN "\x1B[0;1;36m"
|
||||
#define ANSI_HIGHLIGHT_WHITE "\x1B[0;1;37m"
|
||||
|
||||
/* Underlined */
|
||||
#define ANSI_HIGHLIGHT_BLACK_UNDERLINE "\x1B[0;1;4;30m"
|
||||
#define ANSI_HIGHLIGHT_RED_UNDERLINE "\x1B[0;1;4;31m"
|
||||
#define ANSI_HIGHLIGHT_GREEN_UNDERLINE "\x1B[0;1;4;32m"
|
||||
#define ANSI_HIGHLIGHT_YELLOW_UNDERLINE "\x1B[0;1;4;33m"
|
||||
#define ANSI_HIGHLIGHT_BLUE_UNDERLINE "\x1B[0;1;4;34m"
|
||||
#define ANSI_HIGHLIGHT_MAGENTA_UNDERLINE "\x1B[0;1;4;35m"
|
||||
#define ANSI_HIGHLIGHT_CYAN_UNDERLINE "\x1B[0;1;4;36m"
|
||||
#define ANSI_HIGHLIGHT_WHITE_UNDERLINE "\x1B[0;1;4;37m"
|
||||
|
||||
/* Other ANSI codes */
|
||||
#define ANSI_UNDERLINE "\x1B[0;4m"
|
||||
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
|
||||
#define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
|
||||
|
||||
/* Reset/clear ANSI styles */
|
||||
#define ANSI_NORMAL "\x1B[0m"
|
||||
|
||||
/* Erase characters until the end of the line */
|
||||
#define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
|
||||
|
||||
/* Set cursor to top left corner and clear screen */
|
||||
|
|
|
@ -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" },
|
||||
|
|
Loading…
Reference in a new issue