aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/syntax_tools/src/erl_tidy.erl16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl
index 0c149634f6..8507ff646e 100644
--- a/lib/syntax_tools/src/erl_tidy.erl
+++ b/lib/syntax_tools/src/erl_tidy.erl
@@ -309,9 +309,15 @@ file_2(Name, Opts) ->
true ->
ok;
false ->
- write_module(Tree, Name, Opts1),
- ok
- end.
+ case proplists:get_bool(stdout, Opts1) of
+ true ->
+ print_module(Tree, Opts1),
+ ok;
+ false ->
+ write_module(Tree, Name, Opts1),
+ ok
+ end
+ end.
read_module(Name, Opts) ->
verbose("reading module `~ts'.", [filename(Name)], Opts),
@@ -399,6 +405,10 @@ write_module(Tree, Name, Opts) ->
throw(R)
end.
+print_module(Tree, Opts) ->
+ Printer = proplists:get_value(printer, Opts),
+ io:format(Printer(Tree, Opts)).
+
output(FD, Printer, Tree, Opts) ->
io:put_chars(FD, Printer(Tree, Opts)),
io:nl(FD).