Print helpful messages when no commands available
This commit is contained in:
parent
80e2bd19b9
commit
1f07700930
|
@ -125,9 +125,15 @@ get_commands() ->
|
||||||
[{Cmd, M, F} || {{_Seq, Cmd}, {M, F}, _Opts} <- ets:tab2list(?CMD_TAB)].
|
[{Cmd, M, F} || {{_Seq, Cmd}, {M, F}, _Opts} <- ets:tab2list(?CMD_TAB)].
|
||||||
|
|
||||||
help() ->
|
help() ->
|
||||||
|
case ets:tab2list(?CMD_TAB) of
|
||||||
|
[] ->
|
||||||
|
print("No commands available, make sure you have plugin emqx_management started.~n");
|
||||||
|
Cmds ->
|
||||||
print("Usage: ~s~n", [?MODULE]),
|
print("Usage: ~s~n", [?MODULE]),
|
||||||
[begin print("~110..-s~n", [""]), Mod:Cmd(usage) end
|
list:foreach(fun({_, {Mod, Cmd}, _}) ->
|
||||||
|| {_, {Mod, Cmd}, _} <- ets:tab2list(?CMD_TAB)].
|
print("~110..-s~n", [""]), Mod:Cmd(usage)
|
||||||
|
end, Cmds)
|
||||||
|
end.
|
||||||
|
|
||||||
-spec(print(io:format()) -> ok).
|
-spec(print(io:format()) -> ok).
|
||||||
print(Msg) ->
|
print(Msg) ->
|
||||||
|
|
Loading…
Reference in New Issue