25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Document 'any' argument and result type, useful for internal commands

Also 'atom' may be used as argument type by some internal commands,
for example the ones that refer to erlang node names.
This commit is contained in:
Badlop 2024-05-28 18:36:01 +02:00
parent 30bd8f1570
commit ed4843b0ed
2 changed files with 12 additions and 4 deletions

View File

@ -19,13 +19,18 @@
%%%----------------------------------------------------------------------
-type aterm() :: {atom(), atype()}.
-type atype() :: integer | string | binary |
-type atype() :: integer | string | binary | any | atom |
{tuple, [aterm()]} | {list, aterm()}.
-type rterm() :: {atom(), rtype()}.
-type rtype() :: integer | string | atom |
-type rtype() :: integer | string | atom | any |
{tuple, [rterm()]} | {list, rterm()} |
rescode | restuple.
%% The 'any' and 'atom' argument types and 'any' result type
%% should only be used %% by commands with tag 'internal',
%% which are meant to be used only internally in ejabberd,
%% and not called using external frontends.
%% The purpose of a command can either be:
%% - informative: its purpose is to obtain information
%% - modifier: its purpose is to produce some change in the server

View File

@ -976,11 +976,14 @@ format_usage_ctype1({Name, Type, Description}, Indentation, ShCode) ->
format_usage_ctype(Type, _Indentation)
when (Type==atom) or (Type==integer) or (Type==string) or (Type==binary) or (Type==rescode) or (Type==restuple)->
when (Type==atom) or (Type==integer) or (Type==string) or (Type==binary)
or (Type==rescode) or (Type==restuple) ->
io_lib:format("~p", [Type]);
format_usage_ctype({Name, Type}, _Indentation)
when (Type==atom) or (Type==integer) or (Type==string) or (Type==binary) or (Type==rescode) or (Type==restuple)->
when (Type==atom) or (Type==integer) or (Type==string) or (Type==binary)
or (Type==rescode) or (Type==restuple)
or (Type==any) ->
io_lib:format("~p::~p", [Name, Type]);
format_usage_ctype({Name, {list, ElementDef}}, Indentation) ->