List substitution variable names in 'list-templates' command.

This commit is contained in:
hirschen 2012-06-11 14:49:42 +02:00
parent b1d06a4d14
commit 4414f6548a

View file

@ -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.