Permalink
Browse files

--sys-conf=Path

  • Loading branch information...
1 parent bb33329 commit 915bc197af80b612a0c8ed8e5816d0697114c2f6 @etrepum etrepum committed Jul 18, 2010
Showing with 13 additions and 6 deletions.
  1. +13 −6 erldocs
View
19 erldocs
@@ -8,10 +8,10 @@ main(Args) ->
ok = file:set_cwd(filename:dirname(escript:script_name())),
ok = filelib:ensure_dir("ebin/"),
code:add_path("ebin"),
-
+
{ok, _} = compile:file("src/erldocs.erl", [{outdir, "ebin"}, verbose]),
-
- try dispatch(create_conf(), Args)
+
+ try dispatch(create_conf(sys_conf(Args)), Args)
catch throw:Error ->
log("Error running script:~n ~p",[Error])
end.
@@ -29,11 +29,18 @@ dispatch(Conf, _) ->
log("Woot, finished in ~p Minutes ~p Seconds~n",
[Mins, trunc((Diff * 1.0e-6) - (Mins * 60))]).
-create_conf() ->
- {ok, [Config]} = file:consult("priv/sys.conf"),
+sys_conf([]) ->
+ "priv/sys.conf";
+sys_conf(["--sys-conf=" ++ Path | _T]) ->
+ Path;
+sys_conf([_H | T]) ->
+ sys_conf(T).
+
+create_conf(Path) ->
+ {ok, [Config]} = file:consult(Path),
{erldocs, Conf} = lists:keyfind(erldocs, 1, Config),
{ok, Root} = file:get_cwd(),
- [{root, Root} | Conf].
+ [{root, Root} | Conf].
log(Str, Args) ->
io:format(Str, Args).

0 comments on commit 915bc19

Please sign in to comment.