Skip to content

Commit

Permalink
Merge pull request #2856 from choptastic/add_missing_dot
Browse files Browse the repository at this point in the history
Append . to --eval arg if missing
  • Loading branch information
ferd authored Jan 11, 2024
2 parents 5e8165b + b0ee688 commit 8207d82
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 8207d82

Please sign in to comment.