Skip to content

Commit

Permalink
Append . to --eval arg if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
choptastic committed Jan 9, 2024
1 parent 4763199 commit ac68550
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/rebar/src/rebar_prv_shell.erl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ simulate_proc_lib() ->

maybe_run_eval(State) ->
Exprs = find_evals_to_run(State),
lists:map(fun(Expr) ->
lists:map(fun(Expr0) ->
Expr = maybe_append_dot(Expr0),
?INFO("Evaluating: ~p",[Expr]),
{ok, _} = eval(Expr)
end, Exprs).
Expand All @@ -386,6 +387,15 @@ eval(Expression) ->
end
end.

maybe_append_dot(Expression) ->
case re:run(Expression, "\\.\\s*", [{capture, none}, unicode]) of
nomatch ->
?DEBUG("Appending missing '.' to the end of ~p",[Expression]),
Expression ++ ".";
match ->
Expression
end.

setup_name(State) ->
{Long, Short, Opts} = rebar_dist_utils:find_options(State),
rebar_dist_utils:either(Long, Short, Opts).
Expand Down

0 comments on commit ac68550

Please sign in to comment.