anchor.diff:  -module(rebar_config).
   
   -export([new/0, new/1,
  -         get/3, get_list/3,
  -         delete/2,
  +         get/3, get_local/3, get_list/3,
  +         get_all/2,
  +         set/3,
            set_global/2, get_global/2,
            is_verbose/0]).
   
  
positive.code:     ConfigFile = filename:join([Dir, "rebar.config"]),
      case file:consult(ConfigFile) of
          {ok, Terms} ->
              Opts = Terms ++ ParentConfig#config.opts;
          {error, enoent} ->
              Opts = ParentConfig#config.opts;
          Other ->
              Opts = undefined, % Keep erlc happy
              ?WARN("Failed to load ~s: ~p\n", [ConfigFile, Other]),
              ?FAIL
      end,
      #config { dir = Dir, opts = Opts }.
  
  get_list(Config, Key, Default) ->
      get(Config, Key, Default).
  
  get(Config, Key, Default) ->
      proplists:get_value(Key, Config#config.opts, Default).
  
  delete(Config, Key) ->
      Config#config { opts = proplists:delete(Key, Config#config.opts) }.
  
  set_global(Key, Value) ->
      application:set_env(rebar_global, Key, Value).
  
negative.code: %% ===================================================================
  %% Internal functions
  %% ===================================================================
  
  local_opts([], Acc) ->
      lists:reverse(Acc);
  local_opts([local | _Rest], Acc) ->
      lists:reverse(Acc);
  local_opts([Item | Rest], Acc) ->
      local_opts(Rest, [Item | Acc]).
  