No description
.vscode | ||
source/sdiff | ||
.gitignore | ||
dub.json | ||
dub.selections.json | ||
LICENSE | ||
README.md |
Simply Diff
A minimal D wrapper over xdiff.d for computing file differences and generating patches.
Features
- Create in-memory files (
MMFile
) from strings, string arrays, or raw bytes. - Compute diffs between two in-memory files.
- Collect results as
MMBlocks
, convertible to a string or byte slice.
Installation
Add to dub.json
:
{
"dependencies": {
"sdiff": "~>0.1.0"
}
}
Or
{
"dependencies": {
"sdiff": {
"repository": "git+https://git.zhirov.kz/dlang/sdiff.git",
"version": "<hash from git>"
}
}
}
Run dub build
.
Example
import sdiff;
import std.stdio : writeln;
void main()
{
auto a = new MMFile("hello world\n");
auto b = new MMFile("hello world!\n");
auto patch = a.diff(b);
writeln(patch);
}
Output:
@@ -1,1 +1,1 @@
-hello world
+hello world!
License
Boost Software License 1.0. See LICENSE.