summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-11-19 23:43:50 +0000
committerFred Hebert <mononcqc@ferd.ca>2015-11-19 23:50:14 +0000
commitbf347caa55588b1f38cfaed267111d4c0163d522 (patch)
tree0f496cfdcc8e591cba6281a74362ce2c714eb62a /src
parent73c3c5552ae50e9cebd3873f8baaf8812f9a9dbf (diff)
Handle force flags in leading position
The checking of flags and the parsing of arguments is separated up.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_new.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rebar_prv_new.erl b/src/rebar_prv_new.erl
index 6574aca..28572a9 100644
--- a/src/rebar_prv_new.erl
+++ b/src/rebar_prv_new.erl
@@ -32,7 +32,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
- case rebar_state:command_args(State) of
+ case strip_flags(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)),
@@ -72,6 +72,10 @@ info() ->
"Valid command line options:~n"
" <template> [var=foo,...]~n", []).
+strip_flags([]) -> [];
+strip_flags(["-"++_|Opts]) -> strip_flags(Opts);
+strip_flags([Opt | Opts]) -> [Opt | strip_flags(Opts)].
+
is_forced(State) ->
{Args, _} = rebar_state:command_parsed_args(State),
case proplists:get_value(force, Args) of