diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-11-19 17:53:51 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-11-19 17:53:51 -0600 |
commit | d2628b69403ac5509a8674452791d6b22bc9884e (patch) | |
tree | 0f496cfdcc8e591cba6281a74362ce2c714eb62a /src | |
parent | 73c3c5552ae50e9cebd3873f8baaf8812f9a9dbf (diff) | |
parent | bf347caa55588b1f38cfaed267111d4c0163d522 (diff) |
Merge pull request #930 from ferd/handle-new-flag
Handle force flags in leading position
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_new.erl | 6 |
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 |