diff options
Diffstat (limited to 'src/rebar_templater.erl')
-rw-r--r-- | src/rebar_templater.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index f608512..603942a 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -62,10 +62,17 @@ %% Build a list of available templates AvailTemplates = find_disk_templates() ++ find_escript_templates(), ?CONSOLE("Available templates:\n", []), - _ = [begin - BaseName = filename:basename(F, ".template"), - ?CONSOLE("\t* ~s: ~s (~p)\n", [BaseName, F, Type]) - end || {Type, F} <- AvailTemplates], + lists:foreach( + fun({Type, F}) -> + BaseName = filename:basename(F, ".template"), + TemplateTerms = consult(load_file(Type, F)), + {_, VarList} = lists:keyfind(variables, 1, TemplateTerms), + Vars = lists:foldl(fun({V,_}, Acc) -> + [atom_to_list(V) | Acc] + end, [], VarList), + ?CONSOLE(" * ~s: ~s (~p) (variables: ~p)\n", + [BaseName, F, Type, string:join(Vars, ", ")]) + end, AvailTemplates), ok. @@ -258,7 +265,7 @@ update_vars([Key | Rest], Dict) -> %% -%% Given a string or binary, parse it into a list of terms, ala file:consult/0 +%% Given a string or binary, parse it into a list of terms, ala file:consult/1 %% consult(Str) when is_list(Str) -> consult([], Str, []); |