File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
src/libutil/include/nix/util Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -65,4 +65,7 @@ if get_option('json-schema-checks')
6565endif
6666if get_option (' kaitai-struct-checks' )
6767 subproject (' kaitai-struct-checks' )
68+
69+ if get_option (' color' )
70+ add_project_arguments (' -DNIX_COLOR' , language : [' c' , ' cpp' ])
6871endif
Original file line number Diff line number Diff line change @@ -41,3 +41,10 @@ option(
4141 value : true ,
4242 description : ' Check JSON schema validity of schemas and examples (requires jv)' ,
4343)
44+
45+ option (
46+ ' color' ,
47+ type : ' boolean' ,
48+ value : true ,
49+ description : ' Output ANSI escape sequences' ,
50+ )
Original file line number Diff line number Diff line change 88
99namespace nix {
1010
11+ #ifdef NIX_COLOR
1112#define ANSI_NORMAL " \e[0m"
1213#define ANSI_BOLD " \e[1m"
1314#define ANSI_FAINT " \e[2m"
@@ -18,5 +19,17 @@ namespace nix {
1819#define ANSI_BLUE " \e[34;1m"
1920#define ANSI_MAGENTA " \e[35;1m"
2021#define ANSI_CYAN " \e[36;1m"
22+ #else
23+ #define ANSI_NORMAL " "
24+ #define ANSI_BOLD " "
25+ #define ANSI_FAINT " "
26+ #define ANSI_ITALIC " "
27+ #define ANSI_RED " "
28+ #define ANSI_GREEN " "
29+ #define ANSI_WARNING " "
30+ #define ANSI_BLUE " "
31+ #define ANSI_MAGENTA " "
32+ #define ANSI_CYAN " "
33+ #endif
2134
2235} // namespace nix
You can’t perform that action at this time.
0 commit comments