feat(emqx_ctl): support hidden commands
hidden commands do not deserve a place in the usage page
This commit is contained in:
parent
47f826f99a
commit
96a41ac6bd
|
@ -157,18 +157,21 @@ help() ->
|
||||||
print("No commands available.~n");
|
print("No commands available.~n");
|
||||||
Cmds ->
|
Cmds ->
|
||||||
print("Usage: ~ts~n", ["emqx ctl"]),
|
print("Usage: ~ts~n", ["emqx ctl"]),
|
||||||
lists:foreach(
|
lists:foreach(fun print_usage/1, Cmds)
|
||||||
fun({_, {Mod, Cmd}, _}) ->
|
|
||||||
print("~110..-s~n", [""]),
|
|
||||||
apply(Mod, Cmd, [usage])
|
|
||||||
end,
|
|
||||||
Cmds
|
|
||||||
)
|
|
||||||
end;
|
end;
|
||||||
false ->
|
false ->
|
||||||
print("Command table is initializing.~n")
|
print("Command table is initializing.~n")
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
print_usage({_, {Mod, Cmd}, Opts}) ->
|
||||||
|
case proplists:get_bool(hidden, Opts) of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
false ->
|
||||||
|
print("~110..-s~n", [""]),
|
||||||
|
apply(Mod, Cmd, [usage])
|
||||||
|
end.
|
||||||
|
|
||||||
-spec print(io:format()) -> ok.
|
-spec print(io:format()) -> ok.
|
||||||
print(Msg) ->
|
print(Msg) ->
|
||||||
io:format("~ts", [format(Msg, [])]).
|
io:format("~ts", [format(Msg, [])]).
|
||||||
|
|
Loading…
Reference in New Issue