mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Adding generic get/3; still need some cleanup
This commit is contained in:
parent
b3909cc9dc
commit
cf6738928d
1 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
||||||
-export([new/1,
|
-export([new/1,
|
||||||
get_modules/2,
|
get_modules/2,
|
||||||
get_list/3,
|
get_list/3,
|
||||||
|
get/3,
|
||||||
set_global/2, get_global/2]).
|
set_global/2, get_global/2]).
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
@ -74,6 +75,14 @@ get_list(Config, Key, Default) ->
|
||||||
List
|
List
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
get(Config, Key, Default) ->
|
||||||
|
case orddict:find(Key, Config#config.opts) of
|
||||||
|
error ->
|
||||||
|
Default;
|
||||||
|
{ok, Value} ->
|
||||||
|
Value
|
||||||
|
end.
|
||||||
|
|
||||||
set_global(Key, Value) ->
|
set_global(Key, Value) ->
|
||||||
application:set_env(rebar_global, Key, Value).
|
application:set_env(rebar_global, Key, Value).
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue