mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Fix bug 438; add support for listing available templates
This commit is contained in:
parent
8a5eea5ef1
commit
b063d3b8df
2 changed files with 16 additions and 0 deletions
|
@ -207,6 +207,7 @@ compile Compile sources
|
|||
create template= [var=foo,...] Create skel based on template and vars
|
||||
create-app [appid=myapp] Create simple app skel
|
||||
create-node [nodeid=mynode] Create simple node skel
|
||||
list-templates List available templates
|
||||
|
||||
doc Generate Erlang program documentation
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
-export(['create-app'/2,
|
||||
'create-node'/2,
|
||||
'list-templates'/2,
|
||||
create/2]).
|
||||
|
||||
-include("rebar.hrl").
|
||||
|
@ -48,6 +49,20 @@
|
|||
rebar_config:set_global(template, "simplenode"),
|
||||
create(Config, File).
|
||||
|
||||
'list-templates'(_Config, _File) ->
|
||||
%% Load a list of all the files in the escript -- cache it in the pdict
|
||||
%% since we'll potentially need to walk it several times over the course
|
||||
%% of a run.
|
||||
cache_escript_files(),
|
||||
|
||||
%% Build a list of available templates
|
||||
AvailTemplates = find_disk_templates() ++ find_escript_templates(),
|
||||
?CONSOLE("Available templates:\n", []),
|
||||
[?CONSOLE("\t* ~s: ~s (~p)\n", [filename:basename(F, ".template"), F, Type]) ||
|
||||
{Type, F} <- AvailTemplates],
|
||||
ok.
|
||||
|
||||
|
||||
create(_Config, _) ->
|
||||
%% Load a list of all the files in the escript -- cache it in the pdict
|
||||
%% since we'll potentially need to walk it several times over the course
|
||||
|
|
Loading…
Reference in a new issue