From 392abf148122be020f3955005497d488d3f881fd Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Tue, 11 Nov 2014 01:27:41 +0000 Subject: First unkeyed var is now 'name', appid -> name The first variable can be unkeyed and the provider will sub in the variable name 'name'. Additionally, the built-in templates and documentation have been updated so that 'appid' is now 'name' and the alternative commands are shown. --- src/rebar_prv_new.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/rebar_prv_new.erl b/src/rebar_prv_new.erl index 93adeb4..e432371 100644 --- a/src/rebar_prv_new.erl +++ b/src/rebar_prv_new.erl @@ -71,7 +71,15 @@ is_forced(State) -> end. parse_opts([]) -> []; -parse_opts([Opt|Opts]) -> [parse_opt(Opt, "") | parse_opts(Opts)]. +parse_opts([Opt|Opts]) -> [parse_first_opt(Opt, "") | parse_opts1(Opts)]. + +parse_opts1([]) -> []; +parse_opts1([Opt|Opts]) -> [parse_opt(Opt, "") | parse_opts1(Opts)]. + +%% If the first argument meets no '=', we got a default 'name' argument +parse_first_opt("", Acc) -> {name, lists:reverse(Acc)}; +parse_first_opt("="++Rest, Acc) -> parse_opt("="++Rest, Acc); +parse_first_opt([H|Str], Acc) -> parse_first_opt(Str, [H|Acc]). %% We convert to atoms dynamically. Horrible in general, but fine in a %% build system's templating tool. -- cgit v1.1