From 4414f6548ac60b8083f00e5da267198e9d842558 Mon Sep 17 00:00:00 2001 From: hirschen Date: Mon, 11 Jun 2012 14:49:42 +0200 Subject: List substitution variable names in 'list-templates' command. --- src/rebar_templater.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index f608512..98fa245 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -64,7 +64,11 @@ ?CONSOLE("Available templates:\n", []), _ = [begin BaseName = filename:basename(F, ".template"), - ?CONSOLE("\t* ~s: ~s (~p)\n", [BaseName, F, Type]) + {ok, Template} = file:consult(F), + {_, VarList} = lists:keyfind(variables, 1, Template), + Vars = lists:foldl(fun({V,_}, Acc) -> [atom_to_list(V)|Acc] end, [], VarList), + ?CONSOLE("\t* ~s: ~s (~p) (variables: ~p)\n", [BaseName, F, Type, + string:join(Vars, ", ")]) end || {Type, F} <- AvailTemplates], ok. -- cgit v1.1