Skip to content

Commit 3edc2e5

Browse files
committed
relx: do not discard command line parameters when parameter is not in config
fix #2967
1 parent b62659b commit 3edc2e5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/rebar/src/rebar_relx.erl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,16 @@ maybe_obey_command_args(RelxConfig, Opts, Args) ->
235235
undefined ->
236236
Acc;
237237
V ->
238-
replace_all_instance(Opt, V, Acc)
238+
add_or_replace_all_instance(Opt, V, Acc)
239239
end
240240
end, RelxConfig, Args).
241241

242-
replace_all_instance(Opt, Value, RelxConfig) ->
243-
lists:map(fun({K, _}) when K =:= Opt -> {K, Value};
244-
(Other) -> Other end, RelxConfig).
242+
add_or_replace_all_instance(Opt, Value, RelxConfig) ->
243+
case lists:keymember(Opt, 1, RelxConfig) of
244+
true -> lists:map(fun({K, _}) when K =:= Opt -> {K, Value};
245+
(Other) -> Other end, RelxConfig);
246+
false -> [{Opt, Value} | RelxConfig]
247+
end.
245248

246249
%%
247250

0 commit comments

Comments
 (0)