Browse Source

'do' returns its final state.

While 'do' skips state updates between subcommands so that:

    rebar3 do a, b  == (rebar3 a && rebar3 b)

The final state of 'b' does not need to be discarded and might in fact
be useful to get when dealing with Rebar3 as an API.

This can be done without breaking the equality relation already
established.
pull/473/head
Fred Hebert 10 years ago
parent
commit
2fabfe1ee8
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/rebar_prv_do.erl

+ 4
- 0
src/rebar_prv_do.erl View File

@ -47,6 +47,8 @@ do_tasks([{TaskStr, Args}|Tail], State) ->
default -> default ->
%% The first task we hit might be a namespace! %% The first task we hit might be a namespace!
case maybe_namespace(State2, Task, Args) of case maybe_namespace(State2, Task, Args) of
{ok, FinalState} when Tail =:= [] ->
{ok, FinalState};
{ok, _} -> {ok, _} ->
do_tasks(Tail, State); do_tasks(Tail, State);
{error, Reason} -> {error, Reason} ->
@ -56,6 +58,8 @@ do_tasks([{TaskStr, Args}|Tail], State) ->
%% We're already in a non-default namespace, check the %% We're already in a non-default namespace, check the
%% task directly. %% task directly.
case rebar_core:process_command(State2, Task) of case rebar_core:process_command(State2, Task) of
{ok, FinalState} when Tail =:= [] ->
{ok, FinalState};
{ok, _} -> {ok, _} ->
do_tasks(Tail, State); do_tasks(Tail, State);
{error, Reason} -> {error, Reason} ->

Loading…
Cancel
Save