Skip to content

Commit 640587c

Browse files
committed
mustache_cli: remove a spurious newline at the end of the output
1 parent dcad76a commit 640587c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bin/mustache_cli.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ let run json_filename template_filename =
3434
let path = Printf.sprintf "%s.mustache" name in
3535
if not (Sys.file_exists path) then None
3636
else Some (load_template path) in
37-
try Mustache.render ~partials tmpl env |> print_endline
37+
try
38+
let output = Mustache.render ~partials tmpl env in
39+
print_string output;
40+
flush stdout
3841
with Mustache.Render_error err ->
3942
Format.eprintf "Template render error:@\n%a@."
4043
Mustache.pp_render_error err;

bin/test/partials.t/run.t

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
Simple test:
2-
32
$ mustache data.json foo.mustache
43
Inside the include is "Foo Bar !"
5-
4+
65
Include in child or parent directory:
76
$ mkdir subdir
87
$ echo "Test from {{src}}" > subdir/test.mustache
98
$ echo "{{> subdir/test }}" > from_parent.mustache
109
$ echo '{ "src": "parent" }' > from_parent.json
1110
$ mustache from_parent.json from_parent.mustache
1211
Test from parent
13-
1412

1513
$ mkdir subdir/child
1614
$ echo "{{> ../test }}" > subdir/child/from_child.mustache
1715
$ echo '{ "src": "child" }' > subdir/child/from_child.json
1816
$ (cd subdir/child; mustache from_child.json from_child.mustache)
1917
Test from child
20-

0 commit comments

Comments
 (0)