Follow up to #40 that makes a similar change
to the markdownfmt executable.
Instead of shelling out to the 'diff' program,
run diff inside the binary with pkg/diff,
using filenames 'a/$file' and 'b/$file'.
Secondly, print the diff $file markdownfmt/$file
message to stderr instead of stdout.
I'm also okay with deleting this print statement completely,
but I retained it to match the old behavior.
Combined, this does two things:
The markdownfmt binary is no longer system-dependent
and will work on Windows,
and any other environment where 'diff' isn't available.
The output of markdownfmt -d can now be fed directly
into git apply.
Example output on markdownfmt's README.md
(without #44 where this is fixed).
diff README.md markdownfmt/README.md
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
-markdownfmt
-===========
+# markdownfmt
Fork of github.com/shurcooL/markdownfmt that targets following additions:
@@ -8,8 +7,7 @@
[...snip...]
Follow up to #40 that makes a similar change to the markdownfmt executable.
Instead of shelling out to the 'diff' program, run diff inside the binary with pkg/diff, using filenames 'a/$file' and 'b/$file'.
Secondly, print the
diff $file markdownfmt/$file
message to stderr instead of stdout. I'm also okay with deleting this print statement completely, but I retained it to match the old behavior.Combined, this does two things:
markdownfmt -d
can now be fed directly intogit apply
.Example output on markdownfmt's README.md (without #44 where this is fixed).