From ac685503521a33512c1425d70d3974f2c78365a7 Mon Sep 17 00:00:00 2001 From: Jesse Gumm Date: Tue, 9 Jan 2024 16:06:30 -0600 Subject: [PATCH] Append . to --eval arg if missing --- apps/rebar/src/rebar_prv_shell.erl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index c6fb55995..a54034148 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -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). @@ -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).