diff options
author | Heinz N. Gies <[email protected]> | 2016-02-09 13:51:37 -0500 |
---|---|---|
committer | Heinz N. Gies <[email protected]> | 2016-02-09 13:51:37 -0500 |
commit | 72e4baf906dcf6840880597d365da59e9e6635e0 (patch) | |
tree | 9f5ff288aaf097d6891ce5619102d60ac39b1339 | |
parent | ef1921571bc5e4c3aec4d3b3f36b62efba01c3fd (diff) | |
download | relx-72e4baf906dcf6840880597d365da59e9e6635e0.tar.gz relx-72e4baf906dcf6840880597d365da59e9e6635e0.tar.bz2 relx-72e4baf906dcf6840880597d365da59e9e6635e0.zip |
Add low / high color mode
-rw-r--r-- | src/rlx_cmd_args.erl | 4 | ||||
-rw-r--r-- | src/rlx_state.erl | 4 | ||||
-rw-r--r-- | src/rlx_util.erl | 11 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/rlx_cmd_args.erl b/src/rlx_cmd_args.erl index b64c05d..96ddeba 100644 --- a/src/rlx_cmd_args.erl +++ b/src/rlx_cmd_args.erl @@ -25,7 +25,6 @@ format_error/1]). -include("relx.hrl"). - %%============================================================================ %% API %%============================================================================ @@ -137,7 +136,8 @@ create(log_level, Opts) -> LogLevel = proplists:get_value(log_level, Opts, 0), if LogLevel >= 0, LogLevel =< 3 -> - {log, ec_cmd_log:new(LogLevel, command_line)}; + {log, ec_cmd_log:new(LogLevel, command_line, + rerlx_util:intensity())}; true -> throw(?RLX_ERROR({invalid_log_level, LogLevel})) end; diff --git a/src/rlx_state.erl b/src/rlx_state.erl index 42cd730..a26546d 100644 --- a/src/rlx_state.erl +++ b/src/rlx_state.erl @@ -146,7 +146,9 @@ new(Config, CommandLineConfig, Targets) {ok, Root} = file:get_cwd(), Caller = proplists:get_value(caller, CommandLineConfig, api), - Log = proplists:get_value(log, CommandLineConfig, ec_cmd_log:new(error, Caller)), + Log = proplists:get_value( + log, CommandLineConfig, + ec_cmd_log:new(error, Caller, rlx_util:intensity())), State0 = #state_t{log=Log, config_file=Config, cli_args=CommandLineConfig, diff --git a/src/rlx_util.erl b/src/rlx_util.erl index 9b86ad3..c1f7b38 100644 --- a/src/rlx_util.erl +++ b/src/rlx_util.erl @@ -38,8 +38,10 @@ load_file/3, template_files/0, escript_foldl/3, + intensity/0, symlink_or_copy/2]). +-define(DFLT_INTENSITY, high). -define(ONE_LEVEL_INDENT, " "). %%============================================================================ %% types @@ -297,6 +299,15 @@ cp_r_win32(Source,Dest) -> end, filelib:wildcard(Source)), ok. +intensity() -> + case os:getenv("RELX_COLOR") of + "high" -> + high; + "low" -> + low; + _ -> + ?DFLT_INTENSITY + end. %%%=================================================================== %%% Test Functions %%%=================================================================== |