version bump
This commit is contained in:
parent
16dcc2b2a0
commit
3e7a95d8af
2 changed files with 20 additions and 6 deletions
|
@ -1,10 +1,10 @@
|
||||||
{application,cf,
|
{application,cf,
|
||||||
[{description,"Terminal colour helper"},
|
[{description,"Terminal colour helper"},
|
||||||
{vsn,"0.1.2"},
|
{vsn,"0.1.3"},
|
||||||
{registered,[]},
|
{registered,[]},
|
||||||
{applications,[kernel,stdlib]},
|
{applications,[kernel,stdlib]},
|
||||||
{env,[]},
|
{env,[]},
|
||||||
{modules,[]},
|
{modules,[]},
|
||||||
{contributors,["Heinz N. Gies <heinz@project-fifo.net>"]},
|
{maintainers,["Heinz N. Gies <heinz@project-fifo.net>"]},
|
||||||
{licenses,["MIT"]},
|
{licenses,["MIT"]},
|
||||||
{links,[]}]}.
|
{links,[]}]}.
|
||||||
|
|
22
src/cf.erl
22
src/cf.erl
|
@ -96,22 +96,36 @@ format(Fmt) ->
|
||||||
-define(CFMT_U(Char, Colour),
|
-define(CFMT_U(Char, Colour),
|
||||||
cfmt_([$~, $_, Char | S], Enabled) -> [Colour | cfmt_(S, Enabled)]).
|
cfmt_([$~, $_, Char | S], Enabled) -> [Colour | cfmt_(S, Enabled)]).
|
||||||
|
|
||||||
|
colour_term() ->
|
||||||
|
case application:get_env(cf, colour_term) of
|
||||||
|
{ok, V} ->
|
||||||
|
V;
|
||||||
|
undefined ->
|
||||||
|
V = case os:getenv("TERM") of
|
||||||
|
"xterm" ++ _ ->
|
||||||
|
true;
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end,
|
||||||
|
application:set_env(cf, colour_term, V),
|
||||||
|
V
|
||||||
|
end.
|
||||||
|
|
||||||
cfmt(S) ->
|
cfmt(S) ->
|
||||||
cfmt(S, os:getenv("TERM") =:= "xterm").
|
cfmt(S, colour_term()).
|
||||||
|
|
||||||
cfmt(S, Enabled) ->
|
cfmt(S, Enabled) ->
|
||||||
lists:flatten(cfmt_(S, Enabled)).
|
lists:flatten(cfmt_(S, Enabled)).
|
||||||
|
|
||||||
cfmt_([$~,$!, _C | S], false) ->
|
|
||||||
cfmt_(S, false);
|
|
||||||
cfmt_([$~,$!, $_, _C | S], false) ->
|
cfmt_([$~,$!, $_, _C | S], false) ->
|
||||||
cfmt_(S, false);
|
cfmt_(S, false);
|
||||||
cfmt_([$~,$#, _C | S], false) ->
|
cfmt_([$~,$#, _C | S], false) ->
|
||||||
cfmt_(S, false);
|
cfmt_(S, false);
|
||||||
|
cfmt_([$~,$!, _C | S], false) ->
|
||||||
|
cfmt_(S, false);
|
||||||
|
|
||||||
cfmt_([$~, $!, $_, $_ | S], Enabled) ->
|
cfmt_([$~, $!, $_, $_ | S], Enabled) ->
|
||||||
[?U | cfmt_(S, Enabled)];
|
[?U |cfmt_(S, Enabled)];
|
||||||
cfmt_([$~,$!, $^ | S], Enabled) ->
|
cfmt_([$~,$!, $^ | S], Enabled) ->
|
||||||
[?B | cfmt_(S, Enabled)];
|
[?B | cfmt_(S, Enabled)];
|
||||||
cfmt_([$~,$!, $_, $^ | S], Enabled) ->
|
cfmt_([$~,$!, $_, $^ | S], Enabled) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue