From e949e8cbd80ad41f305ea857b816c3feb95885e2 Mon Sep 17 00:00:00 2001 From: YoukiLin <1045735402@qq.com> Date: Fri, 21 Dec 2018 15:42:42 +0800 Subject: [PATCH] Add format output for test print (#2076) * Add formatted output for the test print --- src/emqx_cli.erl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/emqx_cli.erl b/src/emqx_cli.erl index 6be9093b5..f7d513e9d 100644 --- a/src/emqx_cli.erl +++ b/src/emqx_cli.erl @@ -17,16 +17,17 @@ -export([print/1, print/2, usage/1, usage/2]). print(Msg) -> - io:format(Msg). + io:format(Msg), lists:flatten(io_lib:format("~p", [Msg])). print(Format, Args) -> - io:format(Format, Args). + io:format(Format, Args), lists:flatten(io_lib:format(Format, Args)). usage(CmdList) -> - lists:foreach( + lists:map( fun({Cmd, Descr}) -> - io:format("~-48s# ~s~n", [Cmd, Descr]) + io:format("~-48s# ~s~n", [Cmd, Descr]), + lists:flatten(io_lib:format("~-48s# ~s~n", [Cmd, Descr])) end, CmdList). usage(Format, Args) -> - usage([{Format, Args}]). \ No newline at end of file + usage([{Format, Args}]).