浏览代码

Merge pull request #297 from ferd/better-template-UI

Polish rough edges of 'new' provider
pull/303/head
Tristan Sloughter 10 年前
父节点
当前提交
646e1075c6
共有 1 个文件被更改,包括 12 次插入3 次删除
  1. +12
    -3
      src/rebar_prv_new.erl

+ 12
- 3
src/rebar_prv_new.erl 查看文件

@ -33,15 +33,24 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
case rebar_state:command_args(State) of
["help"] ->
?CONSOLE("Call `rebar3 new help <template>` for a detailed description~n", []),
show_short_templates(rebar_templater:list_templates(State)),
{ok, State};
["help", TemplateName] ->
case lists:keyfind(TemplateName, 1, rebar_templater:list_templates(State)) of
false -> io:format("template not found.~n");
false -> ?CONSOLE("template not found.", []);
Term -> show_template(Term)
end,
{ok, State};
[TemplateName | Opts] ->
Force = is_forced(State),
ok = rebar_templater:new(TemplateName, parse_opts(Opts), Force, State),
case lists:keyfind(TemplateName, 1, rebar_templater:list_templates(State)) of
false ->
?CONSOLE("template not found.", []);
_ ->
Force = is_forced(State),
ok = rebar_templater:new(TemplateName, parse_opts(Opts), Force, State)
end,
{ok, State};
[] ->
show_short_templates(rebar_templater:list_templates(State)),

正在加载...
取消
保存