mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Docs: Optional support to get commands from runtime instead of BEAM files, based in bdeb4a7
This commit is contained in:
parent
d140f99b68
commit
57bd0ef4f5
@ -86,7 +86,8 @@ get_commands_spec() ->
|
|||||||
args_desc = ["Path to file where generated "
|
args_desc = ["Path to file where generated "
|
||||||
"documentation should be stored",
|
"documentation should be stored",
|
||||||
"Regexp matching names of commands or modules "
|
"Regexp matching names of commands or modules "
|
||||||
"that will be included inside generated document",
|
"that will be included inside generated document, "
|
||||||
|
"or `runtime` to get commands registered at runtime",
|
||||||
"Comma separated list of languages (chosen from `java`, `perl`, `xmlrpc`, `json`) "
|
"Comma separated list of languages (chosen from `java`, `perl`, `xmlrpc`, `json`) "
|
||||||
"that will have example invocation include in markdown document"],
|
"that will have example invocation include in markdown document"],
|
||||||
result_desc = "0 if command failed, 1 when succeeded",
|
result_desc = "0 if command failed, 1 when succeeded",
|
||||||
|
@ -477,8 +477,16 @@ maybe_add_policy_arguments(#ejabberd_commands{args=Args1, policy=user}=Cmd) ->
|
|||||||
maybe_add_policy_arguments(Cmd) ->
|
maybe_add_policy_arguments(Cmd) ->
|
||||||
Cmd.
|
Cmd.
|
||||||
|
|
||||||
|
generate_md_output(File, <<"runtime">>, Languages) ->
|
||||||
|
Cmds = lists:map(fun({N, _, _}) ->
|
||||||
|
ejabberd_commands:get_command_definition(N)
|
||||||
|
end, ejabberd_commands:list_commands()),
|
||||||
|
generate_md_output(File, <<".">>, Languages, Cmds);
|
||||||
generate_md_output(File, RegExp, Languages) ->
|
generate_md_output(File, RegExp, Languages) ->
|
||||||
Cmds = find_commands_definitions(),
|
Cmds = find_commands_definitions(),
|
||||||
|
generate_md_output(File, RegExp, Languages, Cmds).
|
||||||
|
|
||||||
|
generate_md_output(File, RegExp, Languages, Cmds) ->
|
||||||
{ok, RE} = re:compile(RegExp),
|
{ok, RE} = re:compile(RegExp),
|
||||||
Cmds2 = lists:filter(fun(#ejabberd_commands{name=Name, module=Module}) ->
|
Cmds2 = lists:filter(fun(#ejabberd_commands{name=Name, module=Module}) ->
|
||||||
re:run(atom_to_list(Name), RE, [{capture, none}]) == match orelse
|
re:run(atom_to_list(Name), RE, [{capture, none}]) == match orelse
|
||||||
|
Loading…
Reference in New Issue
Block a user