refactor: move version prefix string detection to a static fun

this is to make dialyzer happy
This commit is contained in:
Zaiming (Stone) Shi 2022-12-27 18:12:40 +01:00
parent 62d3943fc1
commit cac7e0c5f0
2 changed files with 4 additions and 7 deletions

View File

@ -18,6 +18,7 @@
-export([
edition/0,
edition_vsn_prefix/0,
edition_longstr/0,
description/0,
version/0
@ -45,11 +46,11 @@ description() ->
-spec edition() -> ce | ee.
-ifdef(EMQX_RELEASE_EDITION).
edition() -> ?EMQX_RELEASE_EDITION.
edition_vsn_prefix() -> "e".
edition_longstr() -> <<"Enterprise">>.
-else.
edition() -> ce.
edition_vsn_prefix() -> "v".
edition_longstr() -> <<"Opensource">>.
-endif.

View File

@ -45,11 +45,7 @@ set_prompt_func() ->
prompt_func(PropList) ->
Line = proplists:get_value(history, PropList, 1),
Version = emqx_release:version(),
Prefix =
case emqx_release:edition() of
ce -> "v";
ee -> "e"
end,
Prefix = emqx_release:edition_vsn_prefix(),
case is_alive() of
true -> io_lib:format(<<"~ts~ts(~s)~w> ">>, [Prefix, Version, node(), Line]);
false -> io_lib:format(<<"~ts~ts ~w> ">>, [Prefix, Version, Line])