Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (28 sloc) 0.91 kb
-module(erldocs).
-export([main/1]).
-record(conf, {dirs = [], destination = cwd() ++ "/docs/erldocs"}).
%% @doc Called automatically by escript
-spec main(list()) -> ok.
main(Args) ->
parse(Args, #conf{}).
parse([], #conf{destination = Destination} = Conf) ->
Dirs = case Conf#conf.dirs of
[] -> [cwd()];
Else -> Else
end,
run([{apps, Dirs}, {dest, filename:absname(Destination)}]);
parse(["-o", Dest | Rest], Conf) ->
parse(Rest, Conf#conf{destination=Dest});
parse([Dir | Rest], #conf{dirs = Dirs} = Conf) ->
parse(Rest, Conf#conf{dirs = [Dir | Dirs]}).
run(Conf) ->
try erldocs_core:dispatch(Conf)
catch Type:Error ->
log("Error running script:~n~p~n~p~n",
[erlang:get_stacktrace(), {Type, Error}])
end.
-spec log(string(), [_]) -> ok.
log(Str, Args) ->
io:format(Str, Args).
cwd() ->
element(2, file:get_cwd()).
Jump to Line
Something went wrong with that request. Please try again.