summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2014-11-11 01:27:41 +0000
committerFred Hebert <mononcqc@ferd.ca>2014-11-11 01:27:41 +0000
commit392abf148122be020f3955005497d488d3f881fd (patch)
treec70c4a6b9065b0132e785dcf15b90f9833577c7f /src
parent4ed1c4ef581cb780a4b6e2da7cb4e8243b20a370 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_new.erl10
1 files changed, 9 insertions, 1 deletions
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.