summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index ebdf0fe..6eb4f4b 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -57,7 +57,10 @@
tup_umerge/2,
tup_sort/1,
line_count/1,
- set_httpc_options/0]).
+ set_httpc_options/0,
+ escape_chars/1,
+ escape_double_quotes/1,
+ escape_double_quotes_weak/1]).
%% for internal use only
-export([otp_release/0]).
@@ -684,3 +687,15 @@ set_httpc_options(_, []) ->
set_httpc_options(Scheme, Proxy) ->
{ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
+
+%% escape\ as\ a\ shell\?
+escape_chars(Str) ->
+ re:replace(Str, "([ ()?`!$])", "\\\\&", [global, {return, list}]).
+
+%% "escape inside these"
+escape_double_quotes(Str) ->
+ re:replace(Str, "([\"\\\\`!$*])", "\\\\&", [global, {return, list}]).
+
+%% "escape inside these" but allow *
+escape_double_quotes_weak(Str) ->
+ re:replace(Str, "([\"\\\\`!$])", "\\\\&", [global, {return, list}]).