INTRO
MAD module provides user level interface for console commands.
PROFILE
Each MAD profile must imeplent exposed API:
-define(MAD,[compile/1,app/1,get/1,release/1,resolve/1,clean/1,
start/1,attach/1,stop/1,sh/1,deps/1,up/1,fetch/1,
static/1,eunit/1,strip/1]).
LOOP
main(Params) ->
{ Invalid, Valid } = lists:foldr(
fun (X,{C,R}) when is_atom(X) -> {[],[{X,C}|R]};
(X,{C,R}) -> {[X|C],R} end,
{[],[]}, lists:map(fun atomize/1, Params)),
halt(return(
lists:any(fun({error,X}) -> mad:info("~s~n",[X]), true;
(_) -> false end,
lists:flatten([
lists:foldl(
fun ({Fun,Arg},ErrAcc) ->
mad_hooks:run_hooks(pre, Fun),
Errors = errors((profile()):Fun(Arg)),
mad_hooks:run_hooks(post, Fun),
Errors ++ ErrAcc
end, [], Valid)])))).
This module may refer to: mad_local.